Unable to find resource error from Curl response

送分小仙女□ 提交于 2021-01-29 06:01:41

问题


I am using a curl command to retrieve data like so -

curl http://url/devices/views/all/device.json

This works a treat however gives me a large amount of mostly useless data.

The documentation here states that I can add field specifications to reduces the fields that are returned from the call so I tried -

curl -d 'json={"fields=['kismet_device_base_name']"}' http://url/devices/views/all/device.json

where the fields variable allows you to specifically chose which fields you want returned in the json.

The above command returns this error -

<h1>404</h1>Unable to find resource &#x2F;devices&#x2F;all_devices.ekjson

I thought this may be because the -d variable had to be encoded so tried that and this returned the same error.

I also tried adding -

-H "Content-Type: application/json"

To the curl command and this still brought back the same error.

I also tried building the url like so -

curl  http://url/devices/all_devices.ekjson?fields=['kismet_device_base_name']

Which initially complained about the square brackets in the url so turned of the URL globbing parser by adding -g which actually successfully brought back a response however it was the entire, so the fields specification had not been applied.

Unfortunately the documentation does not actually show an example of how to add field specifications in a curl command!

Any ideas how I can achieve what I am looking for?

来源:https://stackoverflow.com/questions/63565493/unable-to-find-resource-error-from-curl-response

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!