Best practices for designing REST APIs.

πŸ§΅πŸ‘‡πŸ»
The abbreviation REST stands for "REpresentational State Transfer".

REST APIs are used to call resources and allow the software to communicate based on standardized principles, properties, and constraints.
1️⃣ Correct status codes

When developing REST APIs, make sure you use the HTTP status code. This helps your user to know if the request they have made is successful or not.
There are a lot of HTTP status codes. But here are the most common ones:

200Ok
400Bad Request
403Forbidden
404Not Found
500 Internal Server Error

Implement at least these five while building a REST API
2️⃣ Using JSON

JSON is commonly used to exchange data between client and server. Although it is derived from JavaScript, it is supported by other major languages, either natively or through libraries.

So using JSON for accepting and responding to requests is the best practice.
3️⃣ Nested Endpoints

Nested endpoints are the best practice if nested points are related to the endpoint.
Let's, you can get a list of all the cars using /cars endpoint. If you want to see the cars based on the car manufacturer, you should use an endpoint like /cars/manufacturer.
4️⃣ Using SSL Certificate

You can achieve the security of your application by adding a Secure Socket Layer (SSL) certificate. By doing this, you will use HTTPS protocol instead of HTTP and make your site less vulnerable to any malicious attacks.
5️⃣ Versioning Your REST API

You should version your REST API if you are introducing any breaking changes. This way, your clients can still access the old version, and their products will not break as soon as you launch a new release.
And that's pretty much it for this thread.

You can visit RapidAPI Hub (RapidAPI.com/hub?utm_source…) and play around with thousands of REST APIs. πŸ˜‰

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with RapidAPI

RapidAPI Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @Rapid_API

2 Nov
Let's talk about widely used HTTP request methods and how to test them.

In this thread, we will cover:

- GET
- POST
- PUT
- DELETE

πŸ§΅πŸ‘‡πŸ»
πŸ“Œ GET

The GET method is the widely used request method. It is used to get the desired resources from the server.

For example, making a request to the /posts endpoint will return all the available posts.
One thing to note here is that we have used plural noun (/posts) for URL naming.

Using plural nouns for naming URLs is the best practice. It simply reduces the confusion about whether there are one or more posts in the resource collection. Using plural nouns for naming URLs is the best practice.
Read 14 tweets
2 Nov
We always believe in project-based learning. πŸš€

Check out these 11 excellent API-based web development projects you can build using RapidAPI.

Thread πŸ§΅πŸ‘‡πŸ»
1️⃣ Build and sell your own API $$$

- In this video, you'll learn how to make a profitable API and sell it on the RapidAPI Hub.

πŸ”—
2️⃣ Travel Advisor App

- A great tutorial on building and deploying a Google Maps Travel Companion App using a free API available on RapidAPI.

πŸ”—
Read 12 tweets
1 Nov
Here are 20 excellent APIs that can fulfill all your requirements of building a Machine Learning model.

Including voice and facial recognition, text analysis, spam filters APIs, and much more.

Thread πŸ§΅πŸ‘‡πŸ»
1️⃣ Sentiment Analysis

- Enter a string to check the positive or negative tone.

πŸ”— RapidAPI.com/twinword/api/s…

πŸ“ˆ Popularity: 9.6/10
πŸ•› Latency: 342ms
βœ… Service Level: 100%
2️⃣ OOPSpam Spam Filter

- OOPSpam Anti-Spam API helps you better identify spam content for contact forms, comment systems, blogs, live chat, etc.

πŸ”— RapidAPI.com/oopspam/api/oo…

πŸ“ˆ Popularity: 9.3/10
πŸ•› Latency: 351ms
βœ… Service Level: 100%
Read 22 tweets
29 Oct
Introduction to CORS

CORS is an HTTP-based mechanism that lets you request data from one URL to a different URL.

Let's talk about it in a bit more detail. πŸ§΅πŸ‘‡πŸ»
CORS stands for Cross-Origin Resource Sharing.

Half of the definition is clear by the abbreviation. CORS allows a server to share resources with browsers having different origins.
Let's try to understand cross-origin requests via an example:

Suppose you're making an HTTP request from "a .com" to "b .com". That's a cross-origin request.
Read 10 tweets
29 Oct
Everything you need to know about HTTP-based systems.

It is a communication protocol that establishes the connection between web browsers and web servers.

Thread πŸ§΅πŸ‘‡πŸ»
HTTP is entirely based on the client-server model, where the client initiates the request then waits until it receives a response from the server.
Typically, there are 3 main components in the HTTP-based system. πŸ‘‡πŸ» Components of an HTTP-based system.
Read 18 tweets
28 Oct
Here are Top 5 Image Search and Image Recognition APIs you can use in your next project.

Thread πŸ§΅πŸ‘‡πŸ»
1️⃣ Imgur

- Imgur is an online image sharing and image hosting service. Imgur’s API exposes the entire Imgur infrastructure via a standardized programmatic interface.

πŸ”— RapidAPI.com/imgur/api/imgu…

πŸ“ˆ Popularity: 9.9/10
πŸ•› Latency: 251ms
βœ… Service Level: 100%
2️⃣ Web Search

- Billions of webpages, images and news with a single API call.

πŸ”— RapidAPI.com/contextualwebs…

πŸ“ˆ Popularity: 9.8/10
πŸ•› Latency: 1,634ms
βœ… Service Level: 99%
Read 6 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(