REST API - Search a resource

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%20ClickAgreement

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=name%20ClickAgreement

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

Thanks

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=ClickAgreement
?

Cheers,
Marcos Vinícius Pinto

Hi,

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

Cheers

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)

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.

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=name%20ClickAgreement

Thanks!

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

Thanks, Marcos!

I’m using the 7.4.1 version.

Cheers

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

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=…

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

Thanks,

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

I got it! :smiley:

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%20ClickAgreemen&f=activationState%3DEnabled

Thank you all

Cheers

Great, josemaria.arbesu!

Glad It worked to you.

Cheers,
Marcos Vinícius Pinto