The HTTP methods GET, POST, PUT, PATCH, and DELETE allow you to create, read, update, and delete web resources by file transfer.
- GET is used to read, or retrieve, a resource, but not apply any changes. It is a request to simply display information. The web service responds with the requested data in XML or JSON format, either at the command line or in a file.
- POST is used to create new resources, while PUT is usually used to update (replace) existing resources.
- PATCH used to update part of an existing resource, such as when you only need to update a single field in a resource. PATCH requests tend to be faster and more efficient than POST or PUT requests.
- DELETE is used to delete a resource identified in the URL statement.
Commonly for a GET request you would simply add any parameters that you need to the request statement. For example, if you wanted to display metadata for an eBook, you would simply add the ID code for that eBook to your GET statement. Likewise, if you want to delete a record, such as a user account, you would simply add the parameter to identify that user account to a DELETE method request.
The PUT, PATCH, or POST methods can be more complicated. For these requests you can add the parameters to the request statement, but you may prefer to include them in a JSON attachment instead.