问题
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 /devices/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