2016-03-03 22 views
1

這裏是我的服務器上的API:如何與查詢字符串參數捲曲在格式「過濾器[名] = foo」的

https://server/api/v1/products?filter[name]=foo

這個效果很好,當我通過瀏覽器訪問它,和它用以下兩種方法效果很好:

$ cat /tmp/x 
{"filter": {"name": "foo"}} 

$ curl -X GET -H 'Accept: application/json' -k -s --negotiate -u : -H 'Content-Type: application/json' -d "@/tmp/x" https://server/api/v1/products 
{"name": "foo", ...} 

$ curl -X GET -H 'Accept: application/json' -k -s --negotiate -u : -d "filter[name]=foo" https://server/api/v1/products 
{"name": "foo", ...} 

現在我想要做到這一點的:

$ curl -X GET -H 'Accept: application/json' -k -s --negotiate -u : https://server/api/v1/products?filter[name]=foo 
$ echo $? 
3 

錯誤代碼爲3,表示「URL格式錯誤」。語法不正確「

我應該如何在URL中指定的查詢字符串參數

+0

也許引用網址? –

回答