Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to submit POST request via API

Tags:

json

api

I did some searching and haven't come across anything for what I am trying to accomplish. I am trying to apply for a new job and there is an option to apply by API. This is new to me so I thought I would give it a try and pick up some learning along the way. I have some understanding of front end development but no experience with JSON. The API instructions are quoted as saying "Simply submit a POST request to our careers endpoint with a raw JSON request body, as shown, and we’ll get back to you!"

POST https://contact.companyname.com/jobs

{
"name": "Jane Doe",
"email": "[email protected]",
"resume": "www.linktoresume.com",
"github": "github.com/jane", // optional
"twitter": "@jane", // optional
"website": "jane.com" // optional
}

For someone without any understanding of where to even start with this, is there a write up on how to start or accomplish this?

like image 247
jamiechalski Avatar asked Jun 16 '18 21:06

jamiechalski


1 Answers

To send an API request you need to use a REST client. A popular client is Postman, they have a lot of great documentation which makes it easy to use.

Also, another method which might be easier is to use curl to send the request. Curl is used on the command line in your terminal. It comes pre-installed on Linux and MacOS or can be downloaded.

Once you have curl you can send your request like this:

curl -d '{"name":"Jane Doe", "email": "[email protected]", "resume": "www.linktoresume.com", "github": "github.com/jane", "twitter": "@jane", "website": "jane.com"}' -H "Content-Type: application/json" -X POST https://contact.companyname.com/jobs

like image 117
brad mcallister Avatar answered Oct 14 '22 05:10

brad mcallister