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.

Table 1. REST API resource areas
Area Path prefix Description

Repositories

/rhui/api/v1/repo/

List, inspect, add, create, delete, and synchronize Red Hat Update Infrastructure repositories.

Packages

/rhui/api/v1/packages/

List, remove, and upload RPM packages in custom repositories.

CDS

/rhui/api/v1/cds/

Generate Kubernetes manifests for a Content Delivery Server deployment.

Tasks

/rhui/api/v1/tasks/

Inspect running and waiting Pulp tasks.

Client

/rhui/api/v1/client/

List repository labels and generate client entitlement certificates and configuration RPMs.

Session

/rhui/api/v1/login

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 rhuiSessionId cookie issued by POST /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/json for single-object responses and errors.
  • application/x-ndjson for 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.

Table 2. Common REST API response codes
Code Description

400

Invalid request. The response body is an Error object.

401

Authentication is required, or the supplied credentials are invalid.

500

Unexpected internal error.

503

The required session signing configuration is missing or invalid.

Red Hat Update Infrastructure now has a Representational State Transfer (REST) API (Application Programming Interface).