REST Web Services API Design

后端 未结 5 1479
轻奢々
轻奢々 2021-02-01 23:13

Just wanted to get feedback on how I am planning to architect my API. Dummy methods below. Here\'s the structure:

GET http://api.domain.com/1/users/ <-- retur         


        
5条回答
  •  梦谈多话
    2021-02-01 23:54

    1. In REST, the HTTP "verb" is used to denote the operation type: you won't be able to express all the CRUD operations with only "GET" and "POST"

    2. no: the URL of the resource is usually where the "document identifier" should appear

    3. The version of the "document" can be transmitted in an HTTP response header upon creation/modification of the said resource. It should be the duty of the server to uniquely identify the resources - trying to do this on the client side will prove a daunting challenge i.e. keeping consistency.

    Of course, there are many variations on the topic...

提交回复
热议问题