Open utterances-bot opened 4 years ago
Great article! Thanks.
Straight to the point 👍👍👍
Nice article! what about sorting? thanks.
@syeikhanugrah api/articles?sort=+author,-publishedDay -publishedDay means Descending +author means ascending , + can be omitted. When looking into your question seen an example to use * to prefix calculated fields. https://jsonapi.org/format/#fetching-sorting
Thank you for your effort, the article very clear and have great examples for easy understanding.
👍👍👍, learned this article.
NIce and easy explanation
Nice one, very informative and well structured!!
This is the best article I've seen REST API design guide. So simple and straightforward.
I agree with not to use verb in URI. But what is the proper way to deal with the case below?
A user sign up a new account and submit related document for identity verification.
Endpoint for admin: GET: /users ---> get all users POST: /users ---> create new user GET: /users/12345 ---> get user info PATCH: /users/12345 ---> edit user info (name, contact, address...)
We may have more than one action on a resource. Example:
My ideas as below but they seem like not proper.
Any thought?
@OKT92
Yes, these are not proper.
I suggest an example.
{
"new_password": "~~~~"
"new_address": "~~~"
}
204 No Content
\
There's no response body
Recommend that use API URI without verb, nested path (You can specify entity id, in this example 12345
) and also use response 204 No Content
when PATCH
request is done successfully
Refer this document
RESTful API Design: 13 Best Practices to Make Your Users Happy
First step to the RESTful way: make sure errors don't come back as 200 OK.
https://florimond.dev/blog/articles/2018/08/restful-api-design-13-best-practices-to-make-your-users-happy/