Edit icon Edit This Page

Make an authenticated request to the panel API of the profile

Make an authenticated request to the panel API of the selected profile and print the answer. rp signs the request with the credential of the profile (see rp auth status); you never pass a token. It is for scripts and AI agents, and for the routes that have no rp command yet. The wire protocols (Maven, npm, Docker, …) are not part of the panel API: use rp setup, push and download for them.

The endpoint is a path on the API host of the profile, for example /api/repos. A full URL is refused, so a request can only go to that host (choose the server with –hostname or –api-url). Two placeholders are filled in. {owner} is the owner segment of a Repsy Cloud profile, and nothing on Repsy OS and on a Cloud custom domain (the segment is dropped), so the same command works on every product. {repo} is the value of –repo.

The method is GET. Giving fields (-f, -F) or –input makes it POST, unless -X says otherwise. With GET and HEAD the fields become query parameters, with the other methods they are sent as a JSON object. -f sends a string. -F converts true, false, null and integers, and reads @file (or @- for stdin) as a string. Field keys are flat: use –input for a nested document.

By default the answer is printed as received. –output json|yaml and –jq parse it as JSON first.

–paginate reads every page of a paged list (page and size are set by rp, 100 per page) and prints one JSON array of all items. An endpoint that is not paged is printed as it is. Paging stops with an error if the server announces pages that never arrive.

Errors are the ProblemDetail of the server (exit 1; exit 4 when the credential is missing or rejected).

rp api <endpoint> [flags]

Examples

rp api /api/repos --paginate --jq '.[].name'
rp api /api/repos/{owner}/{repo}/settings --repo my-repo
rp api -X DELETE /api/repos/{owner}/old-repo
rp api /api/repos -f name=demo -f type=MAVEN
rp api /api/repos --input repo.json -H 'Accept: application/json'

Options

  -F, --field stringArray       Add a typed field key=value (true, false, null, integers, @file, @- for stdin)
  -H, --header stringArray      Add a request header "Name: value" (Authorization cannot be set)
      --input string            Send the content of this file (- for stdin) as the request body
  -X, --method string           HTTP method (GET, POST, PUT, PATCH, DELETE or HEAD; default GET, POST with fields or --input)
      --paginate                Read all pages of a paged list and print one array
  -f, --raw-field stringArray   Add a string field key=value
      --repo string             Repository name for the {repo} placeholder

Options inherited from parent commands

      --api-url string           Panel API URL of the profile, overrides the stored value
      --ca-file string           PEM file with extra trusted CA certificates
      --debug                    Print debug output with secrets redacted
      --hostname string          Repsy host to use instead of the current profile
      --insecure                 Do not verify TLS certificates (unsafe; plain http is chosen with the URL, not with this flag)
      --insecure-storage         Keep credentials in a plain 0600 file instead of the OS keyring (unsafe; a warning is printed once per command)
      --jq string                Filter JSON output with a jq expression (implies --output json)
      --no-color                 Disable colored output
      --no-input                 Never prompt; fail when input is needed
      --output table|json|yaml   Output format: table, json or yaml (default table; json when --jq is given)
      --owner string             Owner segment of Cloud protocol URLs; --owner= means none
      --registry-url string      Protocol host URL of the profile, overrides the stored value
      --type os|cloud            Product of the host, overrides detection
      --web-url string           Panel UI URL of the profile (where /cli/auth lives), overrides the stored value
      --yes                      Answer yes to confirmation prompts

See also

  • rp - Command line client for Repsy OS and Repsy Cloud
Found a problem with this page?