What is the difference between REST and HTTP protocols?

前端 未结 5 765
猫巷女王i
猫巷女王i 2021-01-30 04:27

What is the REST protocol and what does it differ from HTTP protocol ?

5条回答
  •  孤城傲影
    2021-01-30 04:51

    REST is not a protocol, it is a way of exposing your application, mostly done over HTTP.

    for example, you want to expose an api of your application that does getClientById
    instead of creating a URL

    yourapi.com/getClientById?id=4
    you can do
    yourapi.com/clients/id/4

    since you are using a GET method it means that you want to GET data

    You take advantage over the HTTP methods: GET/DELETE/PUT
    yourapi.com/clients/id/4 can also deal with delete, if you send a delete method and not GET, meaning that you want to dekete the record

提交回复
热议问题