Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

curl query parameters get

Tags:

curl

get

I get an error for this CURL command, whereas same works on Chrome DHC App. What am I missing here

[root@host125]# curl -sk -X 'GET' -H 'X-Auth-Token: [REDACTED]' -H 'Content-type: application/json' https://10.1.1.132/rest/rm-central/v1/recovery-sets?query="volumeType EQ 'vvol'"
{"badRequest": {"message": "QueryFilter Error :: Given Query Filter syntax 'query=' is not valid ", "code": 400}}
[root@host125]#
[root@host125]#
[root@host125]#
like image 445
Susanta Dutta Avatar asked Sep 22 '15 18:09

Susanta Dutta


2 Answers

Your URL seems wrong :

https://10.1.1.132/rest/rm-central/v1/recovery-sets?query="volumeType EQ 'vvol'"

especially the query= part.

The quotes should be like this :

'https://10.1.1.132/rest/rm-central/v1/recovery-sets?query=foobar'

or with "double quotes"

like image 129
Gilles Quenot Avatar answered Sep 29 '22 11:09

Gilles Quenot


Below CURL syntax solved my problem:

# curl -k -G -X 'GET' -H 'X-Auth-Token: 5127af39b7584d8c8897a0cad55accdc' -H 'Content-type: application/json' https://10.1.1.132/rest/rm-central/v1/recovery-sets -d "query=\"volumeType%20EQ%20'vvol'\""
like image 30
Susanta Dutta Avatar answered Sep 29 '22 12:09

Susanta Dutta