Pjotrb
1
Hi, a stupid question, but i am just completely stuck here.
I have a cURL call that works fine:
curl -v -X GET
-H “Accept: application/json”
-H “Content-Type: application/json”
-H “Authorization: SSWS ${api_token}”
“${url}/api/v1/users”
But now, when i add a filter to the last line:
“${url}/api/v1/users?filter=status+eq+“ACTIVE””
I get : HTTP status 400 - bad request.
(it does not show in the example but the double quotes around the ACTVE are preceded by a backslash)
I retyped, copied from examples, etc etc. but i cannot get it right
What am i missing here ?
Thanks, Peter
chu123
2
You need to URL encode the quotation marks and spaces when using the filter paramter.
I.e.: ?filter=status%20eq%20%22ACTIVE%22&limit=1
For example, try this:
curl --location --request GET 'https://REPLACE_WITH_YOUR_TENANT/api/v1/users?filter=status%20eq%20%22ACTIVE%22&limit=1' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: SSWS REPLACE_WITH_YOUR_API_KEY'
Of course, I cheated.
I just use Postman and click on the “code” button. This can generate a properly formed CURL command.
2 Likes
dragos
3
Hi @Pjotrb
As @chu123 mentioned, the filter
value needs to be URL encoded. The same applies for search
query parameter.
1 Like
Pjotrb
4
YES! that was it, thanks guys !
system
Closed
5
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.