API Basics

A basic overview of what APIs are and their components.


Curlec APIs are RESTful. Know about the basics of REST APIs, HTTP Methods, Parameters and HTTPS Status codes.

REST is an architectural style or design pattern for APIs. When a client request is made through a RESTful API, it transfers a representation of the state of the requested resource. Web services that follow the REST architectural style are called RESTful web services.

A RESTful web application exposes information about itself in the form of information about its resources. It also enables the client to take actions on those resources, such as creating new resources (for example, creating a new user) or changing existing resources (for example, editing a post).

Use the Curlec Payments API to fetch specific payment (the resource) details. The API response returns the payment state, including payment amount, currency, payment method and more. The representation of the state can be in a JSON format.

GET
/payments/:id

What the server does when the client calls an API depends on the following information:

  • An identifier for the resource: This is the URL for the resource, also known as the endpoint.
  • Operation you want to perform on the resource (in the form of an HTTP method or verb): GET, POST, PUT, PATCH and DELETE.

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 Curlec APIs:

Parameters are options you can pass with the endpoint to influence the response.

There are four types of parameters:

  • Path Parameters: Path parameters are part of the endpoint itself and are not optional.
  • Query Parameters: Query parameters appear after a question mark (?) in the endpoint. Each parameter is listed in the query string right after the other, with an ampersand (&) separating them.
  • Request Parameters: Request parameters are included in the request body and are used to send data via the REST API.
  • Response Parameters: Response parameters represent the response to a request.

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

to know about status codes.

Let us look at the success and error response status codes.

Given below is the list of the most commonly encountered success responses:

Given below is the list of the most commonly encountered error responses:


Was this page helpful?


api basics
rest apis
http methods
status codes