REST API Reference
The Red Hat Update Infrastructure REST API layer exposes frequently used operations over HTTP under the base path prefix /rhui/api/v1/. The current API version is 0.1.0.
The API is grouped into the following resource areas.
| Area | Path prefix | Description |
|---|---|---|
|
Repositories |
|
List, inspect, add, create, delete, and synchronize Red Hat Update Infrastructure repositories. |
|
Packages |
|
List, remove, and upload RPM packages in custom repositories. |
|
CDS |
|
Generate Kubernetes manifests for a Content Delivery Server deployment. |
|
Tasks |
|
Inspect running and waiting Pulp tasks. |
|
Client |
|
List repository labels and generate client entitlement certificates and configuration RPMs. |
|
Session |
|
Authenticate against Pulp and obtain a session cookie. |
Authentication
Except for the public login endpoint, every route accepts either of the following authentication methods:
- HTTP Basic credentials, which are forwarded to Pulp.
- A signed
rhuiSessionIdcookie issued byPOST /rhui/api/v1/login.
Cookie authentication is the preferred method. HTTP Basic authentication creates a new Pulp session on every call, which is a significant overhead when many API calls are sent in a short time. Cookie expiry is configured at the Red Hat Update Infrastructure level and is independent of the Pulp login session length, which is two weeks by default.
To use cookie authentication, SESSION_LENGTH must be configured on the API host. The cookie is signed by using the secret_file value from the [api] section of rhui-tools.conf by default. If the required session signing configuration is missing or invalid, protected routes return HTTP 503.
Response formats
The API uses the following response media types:
application/jsonfor single-object responses and errors.application/x-ndjsonfor streamed, newline-delimited JSON responses, where each line is one JSON object. Streaming responses are used for long-running or per-item operations, such as adding, deleting, or synchronizing repositories, and listing packages.
Common response codes
The following response codes can be returned by most protected endpoints. Endpoint-specific codes are listed with each operation.
| Code | Description |
|---|---|
|
|
Invalid request. The response body is an |
|
|
Authentication is required, or the supplied credentials are invalid. |
|
|
Unexpected internal error. |
|
|
The required session signing configuration is missing or invalid. |
Red Hat Update Infrastructure now has a Representational State Transfer (REST) API (Application Programming Interface).