Este contenido no está disponible en el idioma seleccionado.
Chapter 1. Interacting with Red Hat Insights APIs
Red Hat Insights for Red Hat Enterprise Linux is a predictive analytics service that helps identify and remediate security, performance, and availability threats to your Red Hat infrastructure. Insights for Red Hat Enterprise Linux is built on APIs (Application Program Interfaces) that supply data and functionality to its various applications. The Insights front end (the user interface, or UI) directly communicates with the back end API (the server) to retrieve and display information. You can interact with Insights through the UI, or create your own custom clients to connect directly to the back end API.
You can use API commands to interact with web services to perform various operations, such as retrieving data, sending data, updating records, and deleting records. Using APIs to interact with Insights enables you to perform Insights operations synchronously or asynchronously, depending on the service and endpoint. The Inventory export service is an example of an asynchronous operation, but most operations work synchronously. You can incorporate API calls into your web-based applications, and you can even automate them.
Using APIs presents many advantages, including:
- Better security — Instead of granting users access to data on your server, you can create a structured URL that they can use to request information. This helps to protect sensitive data.
- APIs allow computers to interact directly with other computers.
- APIs can be scripted. You can configure automation to run scripts on demand.
Insights APIs follow the OpenAPI specification. By default, all Insights API resources are represented in application/json
format. In addition, you can also export reports, inventory and maintenance plans as text/csv
.
1.1. About REST API and HTTP methods Copiar enlaceEnlace copiado en el portapapeles!
REST (Representational State Transfer) API is a set of rules and conventions for building and interacting with web services. REST APIs use URLs as resources to communicate with servers using HTTP requests.
HTTP methods perform CRUD (Create, Read, Update, and Delete) operations on API resources. The most common HTTP methods used are:
- GET (retrieve data)
- POST (send data)
- PUT (insert data)
- DELETE (remove data)
- PATCH (update data)
An API request (also known as an API call) requests that the server perform the operation that the HTTP method describes (for example, GET) from the location that the request specifies.
Additional resources
1.2. Response Codes Copiar enlaceEnlace copiado en el portapapeles!
APIs return numerical status codes that indicate whether an API call was successfully processed by the server. If the call fails, the server returns a status code that describes the reason for the failure. The following table shows types of API response codes:
Response code | Response | Description |
100/1xx | Request received | Informational codes. The server has received the request. |
200/2xx | Success | 200 = The server has successfully processed the request. 2xx = The request has succeeded, and more information is available. |
300/3xx | Redirect | The URL/URI of the requested resource exists at a different location than the one you requested. |
400/4xx | Client Error | The request failed. 400 = Bad request 404 = Server not found/resource not found 4xx = The request failed, and the cause of the failure is described. |
500/5xx | Server Error | The server cannot handle the request. |
Additional resources
- For more general information about status codes, see HTTP status codes.
- OpenAPI specification