If you growing like you this article will be useful for you. Time from time you need to test simple requests to API for example GET or POST or PUT, and firs question which appears how to do that. At first let me to describe most popular requests
The GET method requests a representation of the specified resource. Requests using GET should only retrieve data and should have no other effect. (This is also true of some other HTTP methods.)The W3C has published guidance principles on this distinction, saying, Web application design should be informed by the above principles, but also by the relevant limitations.” See safe methods below.
Some other notes on GET requests:
- GET requests can be cached
- GET requests remain in the browser history
- GET requests can be bookmarked
- GET requests should never be used when dealing with sensitive data
- GET requests have length restrictions
- GET requests should be used only to retrieve data
POST is one of many request methods supported by the HTTP protocol used by the World Wide Web. By design, the POST request method requests that a web server accept and store the data enclosed in the body of the request message.It is often used when uploading a file or submitting a completed web form.
Some other notes on POST requests:
- POST requests are never cached
- POST requests do not remain in the browser history
- POST requests cannot be bookmarked
- POST requests have no restrictions on data length
- The PUT method requests that the enclosed entity be stored under the supplied URI. If the URI refers to an already existing resource, it is modified; if the URI does not point to an existing resource, then the server can create the resource with that URI.DELETEThe DELETE method deletes the specified resource.
So I have described three basic and most popular requests POST,PUT and GET, lets go to practice
Tools for sending request Postman or DHC
I am using DHC it has easier interface but sometime using Postman (according to customer requirements) lets have a look how on them and will make short review
DHC, the Dev HTTP Client Chrome app and online service, is now part of Restlet, the leader in API development and deployment in the cloud. Our goal is to bring you a complete platform and a set of tools rapidly decreasing API development time and costs.
Examples of requests
The idea for Postman arose while the founders were working together, and were frustrated with the existing tools for testing APIs. They felt there had to be a better language for
developers to communicate about APIs. This led to the creation of Postman. Postman helps you build, test, and document APIs faster.
Postman features include:
– History of sent requests
– Create requests quickly
– Replay and organize
– Switch context quickly
– Built-in authentication helpers
– Customize with scripts
– Robust testing framework
– Automate collections
All this is available in an intuitive user interface that would make testing APIs effortless.
Note on Permissions
The “Your data on all websites” permission is required to send a request to a domain. It’s not used for anything else. It’s not a new permission and Postman has required it since it