All about APIs

As per the official definition by Mozilla

An HTTP header is a field of an HTTP request or response that passes additional context and metadata about the request or response.

In a simple term client and server can pass the extra bit of information…


This content originally appeared on DEV Community and was authored by Shish Singh

As per the official definition by Mozilla

An HTTP header is a field of an HTTP request or response that passes additional context and metadata about the request or response.

In a simple term client and server can pass the extra bit of information(contextual/meta data) with the request and response using the http headers.

These are further divided into four parts;

  • Request headers
    These are use to send information while making a client to
    sever call.

  • Response headers
    Contrary to the first one, these are use to send information
    while sending the response back to the client from the
    server.

  • Representation headers
    This holds the information about the body of the response.

  • Payload headers
    This is used to hold the information about the payload data.

Commonly used headers

  1. Accept
    Media types/data types are accepted by the server.

  2. Content-type
    This can be used both by clients and servers to identify
    the format of the data in their request or response.

  3. Accept-encoding
    This provides meta-information such as the encoding method
    client can understand.

  4. Host
    It specifies the domain name. This means information such
    as the host and the port.

  5. Authorization
    This is used to pass the credentials (such as information,
    keys or tokens) primarily to let the server authenticate
    the request.

  6. Access-control-allow-origin
    This is to restrict the origin which tries to fetch the
    resource.

  7. Accept-language
    Helps in determining the detail that client is accepting
    the response in the mentioned language.

  8. Access-control-allow-methods
    This helps in knowing which methods are allowed to access
    the cross origin resources.

Http_Calls

Http Request Methods

  1. Get
    The Get method is the most common of all these request
    methods. It is used to fetch the resources from the
    server.

  2. Post
    The Post method is used to submit the information to the
    server. Since, we are submitting the data the post method
    often changes the state of the server.

  3. Put
    The put method is used to change data already present in
    the resource collection.

  4. Patch
    Contrary to put, the patch request method is used to
    modify only the necessary part of the data or response.
    Simply stating it never modifies the entire response.

  5. Delete
    As per its name, delete request method is used to delete
    the specific resource. It requests that the origin server
    delete the resource identified the request URL.

**Resources are datasets in the above statements.


This content originally appeared on DEV Community and was authored by Shish Singh


Print Share Comment Cite Upload Translate Updates
APA

Shish Singh | Sciencx (2023-04-14T18:34:21+00:00) All about APIs. Retrieved from https://www.scien.cx/2023/04/14/all-about-apis/

MLA
" » All about APIs." Shish Singh | Sciencx - Friday April 14, 2023, https://www.scien.cx/2023/04/14/all-about-apis/
HARVARD
Shish Singh | Sciencx Friday April 14, 2023 » All about APIs., viewed ,<https://www.scien.cx/2023/04/14/all-about-apis/>
VANCOUVER
Shish Singh | Sciencx - » All about APIs. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/04/14/all-about-apis/
CHICAGO
" » All about APIs." Shish Singh | Sciencx - Accessed . https://www.scien.cx/2023/04/14/all-about-apis/
IEEE
" » All about APIs." Shish Singh | Sciencx [Online]. Available: https://www.scien.cx/2023/04/14/all-about-apis/. [Accessed: ]
rf:citation
» All about APIs | Shish Singh | Sciencx | https://www.scien.cx/2023/04/14/all-about-apis/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.