Let's talk about them in a bit more detail π§΅ππ»
Client and server can pass the extra bit of information with the request and response using HTTP headers.
HTTP headers are not case-sensitive.
The HTTP headers are divided into four categories:
1οΈβ£ Request headers: Client to Server
2οΈβ£ Response headers: Server to Client
3οΈβ£ Representation headers: Information about the body of the resource
4οΈβ£ Payload headers: Information about the payload data
π Accept
`Accept` header is used when the client wants to inform the server about the type of data that the client can understand.
For example,
Accept: image/png
π Accept-Encoding
The `Accept-Encoding` header is usually attached with a request to the server, indicating which encoding method is understandable by the client.
For example,
Accept-Encoding: gzip
π Authorization
As the header name suggests, the `Authorization` request header is used to pass the credentials so that the server can authenticate the client.
For example,
Authorization: Basic dgfhWUytzgdfhgSYG
π Accept-Language
The `Accept-Language` request header is used to describe which language is understood by the client.
For example,
Accept-Language: en-US
π Content-Type
`Content-Type` representational header specifies the media type of the resource. This header indicates the content type of the returned data when the client didn't mention any content encoding.
For example,
Content-Type: text/html; charset=UTF-8
π Content-Location
`Content-Location` header indicates the alternate location for the response. It is used when an API can return data in different formats depending on the `Accept` header.
The `Content-Encoding` header is used to compress the message data or payload.
For example,
Content-Encoding: gzip
π Content-Length
As the header name suggests, it indicates the size of the resource or message body in bytes. It can be used with both request and response.
For example,
Content-Length: 148
π Content-Language
`Content-Language` indicates the human logical language of the response. This header is used to deliver resources in multiple languages so that users can choose their preferred language.
For example,
Content-Language: en-US
π Cache-Control
`Cache-Control` header is used as a caching mechanism for both the request and response.
There are several directives(values) that we can pass with this header.
For example,
Cache-Control: max-age
β’ β’ β’
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.
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.