API Basics
An overview of what API's are and their components.
Rolkol APIs are RESTful. Here we explain the basics of REST APIs, HTTP Methods, Parameters and HTTPS Status codes. Please write to us if you face any issues at [email protected]
What are REST APIs
REST is a design pattern for APIs that focuses on resource-based interactions. When a client requests a resource through a RESTful API, the server responds with a representation of that resource's current state. This approach allows for flexible and scalable web services.
RESTful web applications present information about their resources and enable clients to interact with those resources. For instance, clients can create new resources (like users) or modify existing ones (like posts).
The server's response to an API call is determined by two key factors:
Resource Identifier: The unique URL or endpoint that specifies the target resource.
HTTP Method: The action to be performed on the resource, such as GET (retrieve), POST (create), PUT (replace), PATCH (update), or DELETE (remove).
HTTP Methods
HTTP defines a set of request methods, also known as HTTP verbs, to indicate the desired action for a given resource.
Given below is the list of methods commonly adopted by Razorpay APIs:
GET
Requests a representation of the specified resource. Requests using GET should only retrieve data.
POST
Submits an entity to the specified resource, often causing a change in state or side effects on the server.
PUT
Replaces all current representations of the target resource with the request payload.
DELETE
Deletes the specified resource.
PATCH
Applies partial modifications to a resource.
Parameters
Parameters are options you can pass with the endpoint to influence the response.
REST APIs can accept four types of parameters:
Path Parameters: These are embedded within the endpoint URL and are mandatory.
Query Parameters: They follow a question mark (?) in the URL and are separated by ampersands (&).
Request Parameters: These are sent within the request body and are used to provide data to the API.
Response Parameters: These are included in the API's response to represent the returned data.
HTTPS Status Codes
HTTP response status codes indicate whether a specific HTTP request is successfully completed. Responses are grouped into five classes:
Informational responses (100–199)
Successful responses (200–299)
Redirection messages (300–399)
Client error responses (400–499)
Server error responses (500–599)
Refer to Mozilla docs to know about status codes.
Let us look at the success and error response status codes.
Last updated