Need help with the POST request for api2swagger tool

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

7417-temp.png

0 1 291
1 REPLY 1

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" }'