I decided to dive further into what REST APIs really are, and how they are used, as they now appear both in my course syllabus, and as a possible solution for progressing my own internship work.
While searching for information, I came across a blog post titled, What Is a REST API? Examples, Uses, and Challenges (https://blog.postman.com/rest-api-examples/). This post goes over what REST APIs are, how they are used, and what you can do with them.
The post also included a YouTube video, demonstrating setting up a REST API, and this part I found particularly interesting. I saw the person in the video utilize GET, and a command to filter for a specific Id associated with the data they wish to retrieve. This rings a bell for me, as I index database instances with an Id very often at my workplace. As I now need to export some of the data produced by my workplace software, in particular by fetching and filtering various attributes such as by Id, for other platforms, utilizing a REST API to aid me in transferring data could provide the data bridge I need to produce analytics from the software I’ve created.
The post delves into the history of the APIs as well, and talks about how REST can be more efficient than SOAP, and how big names like Facebook and Instagram utilized, and still do utilize, REST APIs to transfer data for their users. I was also intrigued to find out that the Amazon S3 storage buckets also utilize REST APIs, and I’ve worked with them in data courses already.
Some of the benefits of using REST APIs include scalability, flexibility, portability, light-weight, and language/platform independence.
The challenges that need to be accounted for when using REST APIs include ensuring endpoint consistency, keeping the URL structures uniform across teams, versioning, maintaining old APIs while introducing new ones, authentication complexity, including basic or bearer tokens, API keys, or OAuth tokens and passwords, as well as accounting for and preventing security risks, such as through encryption, or protecting keys.
Some best practices recommended by the poster include using correct HTTP status codes, 200, 400, 404, etc, returning informative error messages, making sure to secure your APIs via encryption, input validation, and role-based access. Documentation is also naturally very helpful for reminding yourself what you’ve done or made, and share that information with your team or other coders.
I hope to successfully implement a REST API in the near future!
From the blog CS@Worcester – KeepOnComputing by CoffeeLegend and used with permission of the author. All other rights reserved by the author.