skip to Main Content

I am trying to send a request via Postman to API,
Below is the request type which is accepted by API,

curl https://api.shoonya.com/NorenWClientTP/QuickAuth 
-d "jData={ "apkversion": "1.0.0", "uid": "TRST", "pwd": "s3cur3Id", "factor2":
"31-08-2017", "imei": "134243434", "source": "API"}“

When I send JSON via Postmanenter image description here, it throws the error Invalid Input : jData is not valid json object

What is wrong with this request? Or how can I write JSON which has jData object?

2

Answers


  1. You need to remove "jData =" from you message and try again.

    Also its better to post a json file with curl as below

    curl -X POST -H "Content-Type: application/json" -d @FILENAME DESTINATION
    

    For example:

    curl -X POST -H "Content-Type: application/json" -d @payload.json https://api.shoonya.com/NorenWClientTP/QuickAuth
    
    Login or Signup to reply.
  2. Importing the curl command in to Postman (yes this would have been the easiest way for you to replicate it in Postman) sets the body content type to application/x-www-form-urlencoded not raw as you have it your screenshot.

    Change the content type and the request should work.


    On a side note the body content as you currently have it is not valid JSON and would fail to be parsed as such. Postman even has unbderlined jData= with a red squiggly line`

    screenshot of Postman highlighting an error in JSON

    The valid/correct JSON would be:

    {
      "apkversion": "1.0.0",
      "uid": "TRST",
      "pwd": "s3cur3Id",
      "factor2": "31-08-2017",
      "imei": "134243434",
      "source": "API"
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search