In this blog post, I will go over some of the best practices with REST API design, especially considering performance and security at must for most API consumers. It is worth notice that proper API design will ease the maintenance for many services and applications running on a web browser, as the worst case scenario will be more difficult to maintain and becomes different from what everyone expect.
In summary, the post introduces the crucial ways to design the REST APIs properly, which there are accepted conventions to follow so we won’t run into the problems down the road. Some example practices can be Accept and respond with JSON, where JSON is standard for transferring data, as well as built-in methods for Javascript to encode and decode JSON either through the Fetch API or another HTTP client. Other practices are usage of nouns instead of verb for endpoint path names, since it could conflict with HTTP method which are already the verbs, as well as many other practices such as handling error codes, maintain good security practices, and caching data to improve performance, and versioning the APIs.
The reason I choose this article is because there are many ways to experiments with REST API, with the aim to design a web application that meet consumers need, especially end-user experiences. In most cases, we want to deliver the up-to-date user experience within the web applications, and making sure to handle things that are unexpected. In other words, we need to keep track on features in our web applications, monitoring bugs that occur to many users, and monitor versioning appropriately according to the semantic versioning. In my experience, programming and maintaining a REST API project would take very careful steps to count on user experience, as well as what to and not to access. The best example is the good security practices, which are the process of obtaining SSL/TLS security. The good boundaries for the user is to not access any more information beyond what they expected, because when doing so, they could access into another user’s information, as well as information from the admins of the web server.
From what I learned from the article, applying these practices will help me learn more about making a clean REST API project, maintaining the project in the future long run so users will always have access to their needs. As the project grows, it will often requires a higher demand in terms of backend features, hence careful handling is needed to meet all the expectations overall.
Source: https://stackoverflow.blog/2020/03/02/best-practices-for-rest-api-design/
From the blog CS@Worcester – Hello from Kiet by Kiet Vuong and used with permission of the author. All other rights reserved by the author.
