Hello, I am trying to make a POST request to the api2swagger tool. I need to send json payload. I am not sure what is the correct syntax of sending it. Can anyone please help.
I have tried using the below format, but I get an error saying
readline.js:1021 throw err; ^ SyntaxError: Unexpected token p in JSON at position 1 at JSON.parse (<anonymous>)
api2swagger -e "http://abc/getlink" -X POST -H "Content-Type:application/json" -d {"pid":"p26211074","eid":"12345","no":"98718"} -o test.json
Hi @Nike, try using single quotes around json data,
api2swagger -e "http://abc/getlink" -X POST -H "Content-Type:application/json" -d '{"pid":"p26211074","eid":"12345","no":"98718"}' -o test.json
Use single-quotes around a JSON string, and on Windows escape the double-quotes within the string by prepending a / i.e. '{ "grant_type" : "XXYYZZ" }'
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |