Các câu hỏi liên quan đến restful API
Một câu hỏi khá đơn giản trong quá trình phỏng vấn là 1- What is restful API với câu hỏi này bạn nên có 3 ý chính : 1.1 - Nó là 1 API (application program interface) 1.2 - Nó hoạt động dựa trên HTTP 1.3- Nó cung cấp các method để thao tác với dữ liệu gồm GET, POST, PUT, DELETE 2 - Khác nhau giữa PUT và Patch PUT : update if exist id, or create new Patch : Update if exist id or throw an exception 3 - Json standard in Restful API 3.1 Use nouns instead of verbs in endpoint paths 3.2 Use logical nesting on endpoints /articles /article/id/comments 3.4 - Handle errors gracefully and return standard error codes Common error HTTP status codes include: 400 Bad Request – This means that client-side input fails validation. 401 Unauthorized – This means the user isn’t not authorized to access a resource. It usually returns when the user isn’t authenticated. 403 Forbidden – This means the user is authenticated, but it’s not allowed to access a resource. 404 Not Foun...

Comments
Post a Comment