REST API - Search a resource

1
0
-1

Hi,

i'm having problems with the search function.

If i search a process with two conditions, the second it's not applied.

For example, if i find by version like this it's works:
http://localhost:8080/bonita/API/bpm/process?p=0&c=10&s=version%202

Or if i find by name like this it's works:
http://localhost:8080/bonita/API/bpm/process?p=0&c=10&s=name%20ClickAgre...

But if find by version and name like this, the second condition not applies:
http://localhost:8080/bonita/API/bpm/process?p=0&c=10&s=version%202&s=na...

Can help me with the sintaxis or somebody knows why it doesn't work?

Thanks

2 answers

1
0
-1
This one is the BEST answer!

Hi,

I think according to the documentation that only one parameter can be used in the Search option.

Cheers

Comments

Submitted by mvpdev on Thu, 02/09/2017 - 20:34

May be, altought there is no clear indication about if it suports more than one search parameter. Only one example, and it's using just one 's' parameter.
Look in the documentation, on this link, section "Search for a resource"
http://documentation.bonitasoft.com/?page=rest-api-overview

Cheers,
Marcos Vinícius Pinto

Submitted by Lionel Palacin on Thu, 02/09/2017 - 20:37

Yeah I agree it could be clearer. That being said, in the documentation, only the options filter (f=) can be multiple and therefore shown multiple in the example: http://.../API/{API_name}/{resource_name}?p={page}&c={count}&o={order}&s={query}&f={filter_name}={filter_value}&f=...

Submitted by mvpdev on Thu, 02/09/2017 - 21:24

Yes! The documentation is very faulty, something that I haver veem saying to Bonitasoft since aí started using its software four years ago.

Submitted by josemaria.arbesu on Fri, 02/10/2017 - 08:49

Thanks,

I saw it in some example on the internet. The use of more than one "s" filter.

I got it! :-D

I have tried different combinations with "s" and "f" filters. I was confused that for the "s" filter, the scape character is %20 or " " and for the "f" filter the scape character is %3d or =

The correct combination is:
http://localhost:8080/bonita/API/bpm/process?p=0&c=10&s=name ClickAgreemen&f=activationState=Enabled
or
http://localhost:8080/bonita/API/bpm/process?p=0&c=10&s=name%20ClickAgre...

Thank you all

Cheers

Submitted by mvpdev on Fri, 02/10/2017 - 10:11

Great, josemaria.arbesu!

Glad It worked to you.

Cheers,
Marcos Vinícius Pinto

1
0
-1

Hi josemaria.arbesu!

Have you tried your URL without the encode you put for "=" (%20)?

Can you try the URL like this:
http://localhost:8080/bonita/API/bpm/process?p=0&c=10&s=version=2&s=name...

?

Cheers,
Marcos Vinícius Pinto

Comments

Submitted by josemaria.arbesu on Thu, 02/09/2017 - 16:03

Thanks, Marcos!

Yes, and it's not working.

I use postman to make the test. If i use a browser, iExplorer, for example, i got an empty json with the single filters (http://localhost:8080/bonita/API/bpm/process?p=0&c=10&s=version%202)

Submitted by mvpdev on Thu, 02/09/2017 - 16:07

In your Postman tests the json comes filled? IExplorer is not so recommended... Have you tried in Google Chrome or Mozilla Firefox?
If in Postman it works, in you UI Designer form will work too or in another application who requests in this URL.

Submitted by josemaria.arbesu on Thu, 02/09/2017 - 16:12

Yes, in postman (and iExplorer) the json comes filled when i try the single filters:
http://localhost:8080/bonita/API/bpm/process?p=0&c=10&s=version%202 or
http://localhost:8080/bonita/API/bpm/process?p=0&c=10&s=name%20ClickAgre...

When i try the multiple filter, the json is exactly the same as the single query. Doesn't apply the second filter.

The json of
http://localhost:8080/bonita/API/bpm/process?p=0&c=10&s=version%202

is equal as the json of
http://localhost:8080/bonita/API/bpm/process?p=0&c=10&s=version%202&s=na...

Thanks!

Submitted by mvpdev on Thu, 02/09/2017 - 16:59

Understood.

So this may be a bug, the second filter does not apply. We may need to search if this was solved in earlier versions of Bonita or, at least, this is a knowm bug.

Sorry I can't help you so much.

Cheers,
Marcos Vinícius Pinto

Submitted by josemaria.arbesu on Thu, 02/09/2017 - 17:18

Thanks, Marcos!

I'm using the 7.4.1 version.

Cheers

Testing
Notifications