There are three main characteristics of HTTP Request Methods:
1. Safe 2. Idempotent 3. Cacheable
Let's talk about them in this thread. π§΅ππ»
πΈ Safe
We can call an HTTP request method safe if it doesn't affect the server's state.
The safe methods request the server to send data without performing any modification to the original data. Hence safe methods accomplish read-only operations.
Even though they are read-only operations, they sometimes cause a change in server state; the server can update its statistics.
One thing to note here is that the safe methods never request the server to change its state.
πΈ Idempotent
Idempotent methods have no side effects on the server. We can call them in a row, and they guarantee that they will not affect the server state (except for keeping statistics).
GET, HEAD, OPTIONS, PUT, DELETE, and TRACE methods are idempotent.
All safe methods are idempotent, but not all idempotent methods are safe.
To be an idempotent method, only the state of the server matters, not the code returned by it. Hence DELETE method is idempotent but not safe.
β οΈ Another thing to note here is that the client-side ensures the validation of idempotence. The bad codebase can shatter the idempotent constraint.
πΈ Cacheable
As the term suggests, we can call HTTP response methods cacheable if it is possible to cache the response for later use.
However, there are some constraints: ππ»
Constraints for an HTTP response to be cached:
1. Method should be cacheable. Only GET and HEAD methods are cacheable.
2. PUT and PATCH can be cached if the `Content-Location` header is set.
3. Only a few status codes are cacheable: 200, 203, 204, 206, 300, 301, 404, 405, 410, 414, and 501.
4. Headers like `Cache-Control` can be used to prevent caching.
With that being said, that's pretty much it for this thread.
Visit RapidAPI Hub (RapidAPI.com/hub?utm_sourceβ¦) and build a strong understanding of APIs by playing around with over 35K excellent APIs.
β’ β’ β’
Missing some Tweet in this thread? You can try to
force a refresh
- This API provides sentiment analysis, stemming and lemmatization, part-of-speech tagging and chunking, phrase extraction, and named entity recognition.
API testing is performed to test whether a particular API meets some pre-defined parameters or not.
Let's talk more about API Testing π§΅ππ»
API testing includes testing APIs in isolation to ascertain if they meet the functionality, reliability, latency, performance, security, and other essential parameters.
API testing commonly includes testing APIs with JSON or XML payload sent over HTTP, HTTPS, JMS, and MQ. These are widely used data formats and networking/messaging protocols.
Let's try to know more about Pub/Sub design pattern and learn some facts about it.
π§΅ππ»
Publish/Subscribe (Pub/Sub) is an asynchronous messaging style used in serverless and microservices architectures.
With this model, messages are not sent to a specific subscriber but are instead categorized to be available to all subscribers of the category.
π How Pub/Sub Pattern Based APIs Work
The main characteristic of Pub/Sub APIs is the existence of publishers and subscribers, as the name implies. Publishers categorize messages and those that are subscribed to a specified category receive that message.