Designing an API With Postcode API Methods
- Apr 17, 2022
- 2 min read
POST method: This identifies URI resource and generates new URI for the resource. It returns 201 status code after server validation. If the request fails, the browser alerts you with a warning box. POST method generates new resource, but it has few advantages. It is not safe. If you use it, you will create duplicate resources. However, this method can help you get rid of duplicate resources in your API.

POST method: This method is used to submit data to an API server. The data sent by POST method is stored in the request body. An example of a POST request is a contact form on a website. The data in the contact form is sent to the server. It may be in JSON, XML or query parameters. Other formats can also be used. This method of API calls can be used for different types of data.
PUT method: POST is used for creating and editing resource. When designing an API, you must consider what action you would like to perform on the resource. In a survey application, you might use PUT for a list of questions while using POST for a single question. You do not need to support both methods. Just use the one that suits the object you're trying to retrieve. So, make sure to use the right one when designing an API.
GET: For basic requests, you can use GET. The GET method only requires the URL and the REST API headers. The POST method, on the other hand, creates new resources on a server. This includes a login form, a payment, and a credit card. The server differentiates between GET and POST requests and executes a relevant action. It is also possible to implement an idempotent action for a GET request.
SITES WE SUPPORT
SOCIAL LINKS



Comments