Understanding REST: Verbs, error codes, and authentication

后端 未结 10 2040
你的背包
你的背包 2020-11-22 07:39

I am looking for a way to wrap APIs around default functions in my PHP-based web applications, databases and CMSs.

I have looked around and found several \"skeleton

10条回答
  •  星月不相逢
    2020-11-22 07:41

    1. Use post when you don't know how the new resource URI would look like (you create new user, application would assign the new user it's id), PUT for updating or creating resources that you know how are they going to be represented (example: PUT /myfiles/thisismynewfile.txt)
    2. return the error description in message body
    3. You can use HTTP authentication (if it's enough) Web services should be stateles

提交回复
热议问题