Hello Folks,

As part of our API Testing series, we will see “Sending first POST request in Postman”.

First of all we need some APIs to test. There are many public APIs available which you can use for testing purpose. I will suggest you to register at below site to use free APIs for testing:

GoRest API for Testing

I will keep sharing links of public APIs for testing.

Above website provides you APIs for basic operations i.e. CRUD which we have already learnt in previous posts.

We have already covered about Sending GET request in Postman.

POST:

A HTTP POST method is used to create a new resource in collection of resources with a request body passed as a JSON/XML. If resource is created successfully at the end point, it returns a status code 201( Created) (Not always) and returns response body. It may return 200 (OK) and 204 (No Content) status code as well based on how it is created.

POST is not safe method as it is related to data creation. It is also not idempotent and invoking two identical POST requests will result in two different resources containing the same information with just different resource ids.

Request body contains data which is used to created a new resource. For example- You want to register a user on some portal and you need to pass your name , age and address. Here name, age and address are parameters which hold a value in a request body.

To perform a POST request below steps are performed:

  1. Select the “POST” in http methods drop down.
  2. Pass the request URI in address bar of Postman.
  3. Pass request body in desired format under Body tab.
  4. Add authorization if applicable.
  5. Add headers if applicable.
  6. Click on Send button.

 

URI and request body we can get from above website. In real time, developer will provide you all these details.

URI – https://gorest.co.in/public-api/users/

Above URI is used to register a new user with details provided in request body below.

Request Body in JSON:

Detailed steps to hit a POST request in Postman:

1. Select “POST” http method in drop down.

2. Pass URL for POST in address bar of Postman.

3. Click on “Body” tab and click on “raw” radio button. Select “JSON(application/json)” from the left most drop down. As we have JSON request body so we selected this option. If you have request body in other format, you need to select appropriate. Most common formats are JSON and XML. Paste JSON request body in textarea.

4. To hit POST request, you need to pass authorisation. You need to pass access token for GoREST APIs. You need to sign up and go to profile to get access token as shown below:

5. Go to “Authorization” tab and select “OAuth 2.0” in “Type” drop down. Paste copied access token in “Access Token” text box.

6. Hit the “Send” button. You can see response in “Body” tab of Response section of Postman. (Bottom part). Response in JSON format and it gives you details about registered user.

You can change format of response body by selecting desired format in drop down.

 

More about API Testing in upcoming posts. Stay tuned.

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.
#ThanksForReading
#HappyApiTesting

 

 

 

 

Author: Amod Mahajan

My name is Amod Mahajan and I am an IT employee with 6+ years of experience in Software testing and staying in Bengaluru. My area of interest is Automation testing. I started from basics and went through so many selenium tutorials. Thanks to Mukesh Otwani as his tutorials are easy and cover basics to advance. I have habit of exploring concepts by deep diving. I used to make notes. I thought of sharing my knowledge through posts and now I am here. #KeepLearning #ShareLearning

4 thoughts on “Postman Tutorial Part 5 – Sending POST Request in Postman

  1. Sorry for the late response.. please find below details.

    Request:
    {
    “email” : “abc@gmail.com”,
    “fist_name” : “rudra”,
    “last_name” : “desai”,
    “gender”: “male”
    }

    Response:
    {
    “_meta”: {
    “success”: true,
    “code”: 200,
    “message”: “OK. Everything worked as expected.”,
    “totalCount”: 1976,
    “pageCount”: 99,
    “currentPage”: 1,
    “perPage”: 20,
    “rateLimit”: {
    “limit”: 30,
    “remaining”: 29,
    “reset”: 2
    }
    },
    “result”: [
    {
    “id”: “1163”,
    “name”: “Violet Schiller”,
    “gender”: “female”,
    “dob”: “1933-05-15”,
    “email”: “greg.stamm@farrell.com”,
    “phone”: “1-505-369-9119 x70733”,
    “website”: “http://www.roberts.com/voluptatem-voluptas-voluptatem-nulla-explicabo-animi-deleniti-molestias.html”,
    “address”: “1419 Hackett Street\nWeberburgh, VA 83007-0670”,
    “status”: “inactive”,
    “_links”: {
    “self”: {
    “href”: “https://gorest.co.in/public-api/users/1163”
    },
    “avatar”: {
    “href”: “http://lorempixel.com/250/250/people/?71253”
    }
    }
    },
    {
    “id”: “1165”,
    “name”: “Manuela Bradtke”,
    “gender”: “male”,
    “dob”: “2008-12-28”,
    “email”: “sydnie06@hotmail.com”,
    “phone”: “764-344-4424 x675”,
    “website”: “http://www.schmidt.com/”,
    “address”: “149 Watsica View Apt. 367\nNorth Joesph, GA 23686”,
    “status”: “inactive”,
    “_links”: {
    “self”: {
    “href”: “https://gorest.co.in/public-api/users/1165”
    },
    “avatar”: {
    “href”: “http://lorempixel.com/250/250/people/?11440”
    }
    }
    },
    {
    “id”: “1166”,
    “name”: “Danny Bayer”,
    “gender”: “male”,
    “dob”: “1992-11-02”,
    “email”: “braun.brennon@hotmail.com”,
    “phone”: “337-978-0772”,
    “website”: “http://www.brekke.com/neque-ducimus-ut-facilis-consequuntur-in-reprehenderit”,
    “address”: “468 Lawrence Ville Suite 654\nWest Hillard, FL 58367”,
    “status”: “active”,
    “_links”: {
    “self”: {
    “href”: “https://gorest.co.in/public-api/users/1166”
    },
    “avatar”: {
    “href”: “http://lorempixel.com/250/250/people/?19681”
    }
    }
    },
    {
    “id”: “1167”,
    “name”: “Dante Hahn”,
    “gender”: “male”,
    “dob”: “1932-07-17”,
    “email”: “mohr.carleton@ankunding.com”,
    “phone”: “+19485282501”,
    “website”: “http://www.upton.com/rem-laboriosam-distinctio-dolor-nemo-dolor”,
    “address”: “92996 Ryley Fields Suite 812\nLake Cleveland, IA 47485-0255”,
    “status”: “active”,
    “_links”: {
    “self”: {
    “href”: “https://gorest.co.in/public-api/users/1167”
    },
    “avatar”: {
    “href”: “http://lorempixel.com/250/250/people/?75727”
    }
    }
    },
    {
    “id”: “1168”,
    “name”: “Jo Spencer”,
    “gender”: “male”,
    “dob”: “2016-03-28”,
    “email”: “keeling.sonia@pfannerstill.com”,
    “phone”: “610.998.3495 x19634”,
    “website”: “http://www.ratke.biz/”,
    “address”: “2850 Lynch Grove Apt. 862\nEbertberg, RI 26178”,
    “status”: “inactive”,
    “_links”: {
    “self”: {
    “href”: “https://gorest.co.in/public-api/users/1168”
    },
    “avatar”: {
    “href”: “http://lorempixel.com/250/250/people/?77523”
    }
    }
    },
    {
    “id”: “1169”,
    “name”: “new user Monahan”,
    “gender”: “female”,
    “dob”: “1999-01-28”,
    “email”: “muriel56@hotmail.com”,
    “phone”: “(294) 647-5495”,
    “website”: “http://www.zieme.com/nesciunt-sapiente-soluta-et-non”,
    “address”: “6777 Dietrich Vista Apt. 505\nSchaeferfurt, HI 82988”,
    “status”: “active”,
    “_links”: {
    “self”: {
    “href”: “https://gorest.co.in/public-api/users/1169”
    },
    “avatar”: {
    “href”: “http://lorempixel.com/250/250/people/?78437”
    }
    }
    },
    {
    “id”: “1170”,
    “name”: “Talon Reichel”,
    “gender”: “male”,
    “dob”: “1931-10-08”,
    “email”: “alex52@keebler.net”,
    “phone”: “+1-643-244-5213”,
    “website”: “http://www.jerde.com/sint-reprehenderit-corporis-dolorem-dolorem-rem-et-tempora.html”,
    “address”: “459 Skye Village\nPort Minervahaven, AR 61362-8994”,
    “status”: “active”,
    “_links”: {
    “self”: {
    “href”: “https://gorest.co.in/public-api/users/1170”
    },
    “avatar”: {
    “href”: “http://lorempixel.com/250/250/people/?59502”
    }
    }
    },
    {
    “id”: “1171”,
    “name”: “Clementina Stamm”,
    “gender”: “female”,
    “dob”: “1936-05-22”,
    “email”: “johns.davonte@nolan.com”,
    “phone”: “863.309.3431 x84195”,
    “website”: “http://orn.org/iste-minima-dolorem-ullam-ea”,
    “address”: “5946 Dooley Circle Apt. 461\nPort Alexstad, DC 96664-7527”,
    “status”: “inactive”,
    “_links”: {
    “self”: {
    “href”: “https://gorest.co.in/public-api/users/1171”
    },
    “avatar”: {
    “href”: “http://lorempixel.com/250/250/people/?80315”
    }
    }
    },
    {
    “id”: “1172”,
    “name”: “Claude Stoltenberg”,
    “gender”: “male”,
    “dob”: “2006-02-08”,
    “email”: “giles.batz@hotmail.com”,
    “phone”: “573-984-2328 x235”,
    “website”: “http://www.okon.biz/pariatur-deleniti-quos-a-sed-at-corrupti-ut”,
    “address”: “1946 Volkman Point Suite 796\nJohathanview, TN 74717”,
    “status”: “inactive”,
    “_links”: {
    “self”: {
    “href”: “https://gorest.co.in/public-api/users/1172”
    },
    “avatar”: {
    “href”: “http://lorempixel.com/250/250/people/?35592”
    }
    }
    },
    {
    “id”: “1173”,
    “name”: “Florine Gerhold”,
    “gender”: “female”,
    “dob”: “2011-07-18”,
    “email”: “bechtelar.bernardo@gmail.com”,
    “phone”: “540.351.2836 x0825”,
    “website”: “http://swift.com/quam-consequatur-soluta-architecto-voluptatem”,
    “address”: “8053 Matteo Run\nNew Brennan, KY 47469-4190”,
    “status”: “active”,
    “_links”: {
    “self”: {
    “href”: “https://gorest.co.in/public-api/users/1173”
    },
    “avatar”: {
    “href”: “http://lorempixel.com/250/250/people/?74236”
    }
    }
    },
    {
    “id”: “1174”,
    “name”: “Roberta Dicki”,
    “gender”: “female”,
    “dob”: “1994-07-30”,
    “email”: “agraham@yahoo.com”,
    “phone”: “787.260.4651 x4967”,
    “website”: “http://olson.biz/labore-ut-nulla-earum-non-mollitia-minima”,
    “address”: “603 Bauch Spurs\nEast Reagan, DE 37026”,
    “status”: “inactive”,
    “_links”: {
    “self”: {
    “href”: “https://gorest.co.in/public-api/users/1174”
    },
    “avatar”: {
    “href”: “http://lorempixel.com/250/250/people/?89748”
    }
    }
    },
    {
    “id”: “1175”,
    “name”: “new user Boyer”,
    “gender”: “female”,
    “dob”: “1973-02-04”,
    “email”: “ecarroll@glover.com”,
    “phone”: “410-665-5780 x223”,
    “website”: “http://padberg.com/voluptas-voluptas-illum-officiis-repellat.html”,
    “address”: “7643 Effertz Lock\nWest Ansel, NY 57963”,
    “status”: “inactive”,
    “_links”: {
    “self”: {
    “href”: “https://gorest.co.in/public-api/users/1175”
    },
    “avatar”: {
    “href”: “http://lorempixel.com/250/250/people/?77588”
    }
    }
    },
    {
    “id”: “1176”,
    “name”: “Angelica Daugherty”,
    “gender”: “female”,
    “dob”: “2004-07-17”,
    “email”: “schroeder.dixie@gmail.com”,
    “phone”: “(367) 712-7461 x7672”,
    “website”: “https://www.hamill.com/saepe-ut-necessitatibus-architecto-dolorum”,
    “address”: “3026 Olson Spurs\nBatzstad, NY 66492-8255”,
    “status”: “active”,
    “_links”: {
    “self”: {
    “href”: “https://gorest.co.in/public-api/users/1176”
    },
    “avatar”: {
    “href”: “http://lorempixel.com/250/250/people/?69921”
    }
    }
    },
    {
    “id”: “1177”,
    “name”: “Freddie Keebler”,
    “gender”: “male”,
    “dob”: “1940-07-25”,
    “email”: “kaleigh.kohler@west.com”,
    “phone”: “+1 (853) 617-3263”,
    “website”: “http://www.leffler.com/”,
    “address”: “215 Domenic Plain Apt. 417\nScarlettburgh, IA 21137”,
    “status”: “inactive”,
    “_links”: {
    “self”: {
    “href”: “https://gorest.co.in/public-api/users/1177”
    },
    “avatar”: {
    “href”: “http://lorempixel.com/250/250/people/?75511”
    }
    }
    },
    {
    “id”: “1178”,
    “name”: “Sterling Baumbach”,
    “gender”: “male”,
    “dob”: “1945-11-30”,
    “email”: “hilll.antwon@gmail.com”,
    “phone”: “(514) 866-3572 x35357”,
    “website”: “http://frami.com/qui-libero-voluptas-dolore-qui-ipsam-debitis”,
    “address”: “5769 Lonie Court\nHudsonside, SC 65679-9782”,
    “status”: “inactive”,
    “_links”: {
    “self”: {
    “href”: “https://gorest.co.in/public-api/users/1178”
    },
    “avatar”: {
    “href”: “http://lorempixel.com/250/250/people/?20618”
    }
    }
    },
    {
    “id”: “1179”,
    “name”: “Tobin Ratke”,
    “gender”: “male”,
    “dob”: “1951-03-06”,
    “email”: “imorissette@barton.com”,
    “phone”: “661.748.3845 x0321”,
    “website”: “http://weber.com/non-et-voluptatem-beatae-molestiae-illo-vero-consequuntur”,
    “address”: “4272 Shanahan Land Suite 556\nDeannastad, PA 98459-7280”,
    “status”: “inactive”,
    “_links”: {
    “self”: {
    “href”: “https://gorest.co.in/public-api/users/1179”
    },
    “avatar”: {
    “href”: “http://lorempixel.com/250/250/people/?15803”
    }
    }
    },
    {
    “id”: “1180”,
    “name”: “Alessandra Dibbert”,
    “gender”: “female”,
    “dob”: “1927-12-06”,
    “email”: “fdubuque@altenwerth.com”,
    “phone”: “+1-447-859-7117”,
    “website”: “http://altenwerth.net/aliquid-non-neque-eos”,
    “address”: “6626 Daugherty Harbors\nSchulistberg, IN 37062”,
    “status”: “inactive”,
    “_links”: {
    “self”: {
    “href”: “https://gorest.co.in/public-api/users/1180”
    },
    “avatar”: {
    “href”: “http://lorempixel.com/250/250/people/?40646”
    }
    }
    },
    {
    “id”: “1181”,
    “name”: “Estelle Harber”,
    “gender”: “female”,
    “dob”: “1920-09-11”,
    “email”: “pzieme@romaguera.com”,
    “phone”: “610-331-5941”,
    “website”: “http://www.klein.com/minus-autem-est-laborum-sed-amet”,
    “address”: “1281 Piper Islands Suite 475\nNew Jaysonville, NE 52818-9942”,
    “status”: “inactive”,
    “_links”: {
    “self”: {
    “href”: “https://gorest.co.in/public-api/users/1181”
    },
    “avatar”: {
    “href”: “http://lorempixel.com/250/250/people/?45064”
    }
    }
    },
    {
    “id”: “1182”,
    “name”: “Coby Heidenreich”,
    “gender”: “male”,
    “dob”: “1972-09-03”,
    “email”: “coralie54@franecki.com”,
    “phone”: “459.479.5521 x5961”,
    “website”: “http://graham.info/officia-ratione-non-mollitia-molestiae-aperiam”,
    “address”: “3460 Bruen Burgs\nFunkshire, MN 26773-9354”,
    “status”: “active”,
    “_links”: {
    “self”: {
    “href”: “https://gorest.co.in/public-api/users/1182”
    },
    “avatar”: {
    “href”: “http://lorempixel.com/250/250/people/?15274”
    }
    }
    },
    {
    “id”: “1183”,
    “name”: “Mohamed Bogan”,
    “gender”: “male”,
    “dob”: “1936-05-07”,
    “email”: “boyle.dannie@hickle.com”,
    “phone”: “504-837-2094 x046”,
    “website”: “http://www.schimmel.com/eos-expedita-vel-repudiandae-explicabo-quaerat-assumenda-asperiores”,
    “address”: “935 Werner Mews Apt. 089\nEast Ludietown, SC 73165-2336”,
    “status”: “active”,
    “_links”: {
    “self”: {
    “href”: “https://gorest.co.in/public-api/users/1183”
    },
    “avatar”: {
    “href”: “http://lorempixel.com/250/250/people/?69745”
    }
    }
    }
    ]
    }

    1. In fact when we hit a post request, response shows user got created but it not added in list of users. These apis just for testing purpose without changing actual content.

Leave a Reply