Sie sind auf Seite 1von 2

***API (Application Programming Interface)

REST (REpresentational State Transfer)

Las APIs y el REST; Son términos que significan una forma para que las aplicaciones se comuniquen entre sí.

An API (Application Programming Interface) enables two pieces of software to communicate with each other.

Creating APIs enables the development of rich applications with a wide range of functionality

REST is an API framework built on HTTP, and the interface points are often for web services.

When you combine REST and API, you see a simple service interface that enables applications or people to use the HTTP
protocol to request objects or information.

***HTTP methods: what to ask a REST API?

To start, determine which HTTP verb to use. You may have heard the acronym CRUD, which stands for Create, Read,
Update, and Delete.

Each of the following HTTP verbs corresponds to a CRUD action.

HTTP Verb Typical Action (CRUD)

POST Create

GET Read

PUT Update

PATCH Update

DELETE Delete

***Response status codes:

Status Code Status Message Meaning

200 OK All looks good

201 Created New resource created

400 Bad Request Request was invalid

401 Unauthorized Authentication missing or incorrect

403 Forbidden Request was understood but not allowed

404 Not Found Resource not found

500 Internal Server Error Something wrong with the server

503 Service Unavailable Server is unable to complete request


***REST API headers
Header Example Value Purpose
Content-Type application/json Specify the format of the data in the body.
Specify the requested format for the returned data, such as
Accept application/json
JSON.
Bearer Provide credentials, such as a generated token that can
Authorization
aBcDeFgHiJklMnOor0pQrS5z expire, to authorize a request.
Date/Time
Thu Jan,4 17:02:23 CST 2018 Date and time of a request or response message.
Stamp

***REST payloads
The body of request or response may include a payload that carries data to or from the service. The data format of the
payload is typically JSON or XML.

JSON stands for JavaScript Object Notation. Es un formato ligero de intercambio de datos.

XML stands for eXtensible Markup Language, and XML is designed to store and transport data

Das könnte Ihnen auch gefallen