what is a put api request code example

Example 1: PUT vs POST

"PUT" puts a file or resource at a particular URI and exactly at that
URI. If there is already a file or resource at that URI, PUT changes
that file or resource. If there is no resource or file there, PUT makes
one.

POST sends data to a particular URI and expects the resource at
that URI to deal with the request. The web server at this point
can decide what to do with the data in the context of specified
resource.

Example 2: can we use post request instead of put for creating a resource

Yes we can. Because POST is super set
of all other HTTP methods except get.

Tags:

Misc Example