I am using ASP.NET Web API: http://xyzdomain.com:16845/api/returns/returns
How do I send a POST request to the endpoint using Postman Chrome extension, given Items
is a collection:
[
{
"Items": [
{
"sku": "9257",
"Price": "100",
"Quantity": "500",
"DiscountPercent": "1",
"backordered": "2"
}
],
"order_id": "F429768865001",
"status_code": "Shelf",
"Exception": "no error"
}
]
Send it as raw data and set the type to application/json
This is a combination of the above, because I had to read several posts to understand.
Content-Type
to application/json
Accept
to application/json
{ "Obj1" : { "key1" : "val1" } }
Hope this helps!
The key-value pair can take advanced inputs.
Ex.
Simply add these parameters : In the header option of the request, add Content-Type:application/json
and in the body , select Raw format and put your json params like {'guid':'61791957-81A3-4264-8F32-49BCFB4544D8'}
I've found the solution on http://www.iminfo.in/post/post-json-postman-rest-client-chrome
Just wanted to add one more problem that some people might find on top of all the other answers. Sending JSON object using RAW data and setting the type to application/json
is what is to be done as has been mentioned above.
Even though I had done so, I got error in the POSTMAN request, it was because I accidentally forgot to create a default constructor for both child class.
Say if I had to send a JSON of format:
{
"firstname" : "John",
"lastname" : "Doe",
"book":{
"name":"Some Book",
"price":12.2
}
}
Then just make sure you create a default constructor for Book class.
I know this is a simple and uncommon error, but did certainly help me.
Just for those who want to send a nested JSON object with form-data as content type.
I want to send nested custom_field in below { "description": "Details about the issue...", "subject": "Support Needed...", "type": "Others", "email": "tom@outerspace.com", "priority": 1, "status": 2, **"custom_fields" : { "cf_type_of_issue" : "Complaint" }**, "cc_emails": ["ram@freshdesk.com","diana@freshdesk.com"] }
we can send nested json like the following format
address[city] address[state]
If you want to post single nested dictionary lets say:
Wrong:
{
parent_key: { child_key: child_value }
}
You need to convert it to:
Correct
{
parent_key.child_key: child_value
}
And if you wanted to post list of dictionaries lets say:
Wrong:
{
parent_key: [
{ child_key: child_value },
{ child_key: child_value_02 }
]
}
You need to convert it to:
Correct
{
parent_key[0]child_key: child_value
parent_key[1]child_key: child_value_02
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.