Spread the love

Restful api is very useful today while creating a mobile application or web application.

Restful api or Http request methods

There is 4 types of method of http request.

  1. Post
  2. Get
  3. Put
  4. Delete
  5. Patch
1. Post method

Post method is widely used to fetch the content of a form or uploaded file from client browser.

In php we get fetch data


POST /save/1
    "title": "skwee357",             // New 
    "email": "test@gmail.com"       // new email address
2. GET method

Get method is used the fetch the query string from url or from a form but form should be small.

In php example


GET /save?title=test
3. PUT method

Put method is used when we are updating the form or resource but it includes all entity(fields) to update.

PUT /save/1
    "title": "skwee357",
    "email": "test@gmail.com"       // new email address
4. DELETE method

Delete method is used to delete the componenet

PUT /delete/1
5. PATCH method

Patch method is used for update the existing data or resource but it is used when we are updating single field not all.

PACTH /save/1
    "title": "skwee357",

Leave a Reply