⚠️ This lesson is retired and might contain outdated information.

Create a POST Request in Postman to Send Data to an API Endpoint

Colby Fayock
InstructorColby Fayock
Share this video with your friends

Social Share Links

Send Tweet

In this lesson, you'll learn how to create a new request in Postman to send an HTTP POST request to an API endpoint. We'll walk through creating a new request, setting the HTTP method as POST, and sending custom JSON data to an API endpoint.

Colby Fayock: [0:00] We're going to start off in Postman with a new collection called My Collection. I want to create a post request that I can post data to. To test this out, I created a really simple endpoint that we can use to test out our request. If I visit this endpoint in my browser, it's a GET request and I can see that it was successful.

[0:14] If I look in the terminal, I can see that my Event Path was /post and my HTTP Method was GET. We can also see an error here where it says "Failed to parse body" because we're trying to parse the body from JSON, which it doesn't exist in a GET request.

[0:26] To test this out as a POST request, we can add a new request right in our new collection. Let's call it POST Request and click Save to My Collection. Then we can select that request, we can change the method from GET to POST, and I can paste my endpoint right in the request bar. Now, if I click Send, it'll post that request.

[0:43] I could see that it was successful with the 200 and then we got the OK response. If we look in the terminal, we can see that the Event Path was /post and this time the HTTP Method was POST. We're still getting the error to "Failed to parse body" though, because we're not actually posting a body yet.

[0:57] To include a body inside Postman, we can first navigate over to the Body tab and in our instance we want to include JSON, so we're going to click raw and then we're going to select JSON in this dropdown, and inside this text field we could include our JSON, which I'm going to say "test": true.

[1:11] If we send our POST request, we can see our Event Path is /post, our Method is POST and we can see our new Event Body which says test equals true.

[1:19] While we're using JSON to post this request, depending on the endpoint, you can use a variety of different options like even GraphQL.

[1:25] In review, we had an endpoint where we wanted to post data. In Postman, we first created a new request, where we were then able to set a method to POST instead of GET where we were able to also include a body with the type of JSON that said test equals true. Once we hit Send, we can see it successfully sent and see it successfully post our data.