About
The POST method requests that the target resource process the representation enclosed in the request according to the resource's own specific semantics.
They are by default not cached.
Usage
For example, POST is used for the following functions (among others):
- Providing a block of data, such as the fields entered into an HTML form, to a data-handling process;
- Posting a message to a bulletin board, newsgroup, mailing list, blog, or similar group of articles;
- Creating a new resource that has yet to be identified by the origin server
- Appending data to a resource's existing representation(s).
How to execute a Post request
To create and execute a post request, you can use the following element
- using an HTML form
- using a http library method such as the javascript fetch function
- using a http client such as curl
Example
With CURL, to create a page with a title with Json data
curl -b cookie.txt \
-d '{"page": [{"title": "Hello World"}]}' \
-H "Content-Type: application/json" \
-H "Origin: https://mywebsite.com" \
https://api-host.com/api/posts
Management
Response
If one or more resources has been created on the origin server as a result of successfully processing a POST request, the origin server SHOULD send :
- a 201 (Created) response
- containing a Location header field that provides an identifier for the primary resource created
Cache
Responses to POST requests are only cacheable when they include explicit freshness information