REST Web Services API Design

后端 未结 5 1471
轻奢々
轻奢々 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-02 00:02

    1) On your design probably not. POST is not idempotent! So you should not use for the update or the delete, instead use PUT and DELETE from Rest

    2) A better choice is to use the header Content-Type on the WS call, like: application/xml

    3) Also on the header Content-Type u can use it: application-v1.0/xml

    4) Not sure if it is the best, but probably the easiest way is to use HTTP's built-in authentication mechanisms in RFC 2617. An example: AWS Authentication

提交回复
热议问题