Reset Search
 

 

Article

API giving 400 response when using JSON data as shown in the REST API start guide

« Go Back

Information

 
TitleAPI giving 400 response when using JSON data as shown in the REST API start guide
Question
Why am i getting 400 response when using JSON data "GET"
Environment
Wing 5 X
Answer
to send input data POST should be used instead of GET.

For file-read the parameters are “device” and “path”.
curl -X POST --cookie auth_token=…. http://<IP>/rest/v1/act/file-read -d '{"device":"<mac-address>","path":"flash:/log/messages.log"}' |python -m json.tool |more
curl -X POST --cookie auth_token=…. http://<IP>/rest/v1/act/file-read -d '{"device":"<mac-address>,"path":"startup-config"}' |python -m json.tool |more
 
Examples below:
curl -X POST --cookie auth_token=$cookie http://172.16.0.16/rest/v1/act/file-read -d '{"device":"08-00-27-96-5F-EA","path":"flash:/log/messages.log"}' |python -m json.tool |more
curl -X POST --cookie auth_token=$cookie http://172.16.0.16/rest/v1/act/file-read -d '{"device":"08-00-27-96-5F-EA","path":"startup-config"}' |python -m json.tool |more
 
Additional notes

Feedback

 

Was this article helpful?


   

Feedback

Please tell us how we can make this article more useful.

Characters Remaining: 255