cURL GET查询字符串是一个JSON
我试图使用cURL访问远程RESTful服务API,查询字符串参数有一个JSON值。我的cURL命令如下:cURL GET查询字符串是一个JSON,json,http,curl,Json,Http,Curl,我试图使用cURL访问远程RESTful服务API,查询字符串参数有一个JSON值。我的cURL命令如下: curl -g -i 'http://localhost:8080/context/restdev/employees/?q={"deptno":{"$lte":20}}' 如果我在Chrome中输入URL,我可以取回数据。My cURL命令获取:URI格式不正确,原因:查询中位置48处的非法字符 q={"deptno":{"$lte":20}}' 需要这样做。cURL通过--data
curl -g -i 'http://localhost:8080/context/restdev/employees/?q={"deptno":{"$lte":20}}'
如果我在Chrome中输入URL,我可以取回数据。My cURL命令获取:URI格式不正确,原因:查询中位置48处的非法字符
q={"deptno":{"$lte":20}}'
需要这样做。cURL通过--data urlencode开关支持这一点,因此请尝试以下(一行):
在添加a-G选项以使用GET方法后,现在工作正常
curl -G -i "http://localhost:8080/context/restdev/employees/"
--data-urlencode 'q={"deptno":{"$lte":20}}'