Skip to content

10. API

Ludovic edited this page Nov 4, 2023 · 33 revisions

Repomanager exposes an API that allows performing certain actions from a client host:

  • Registering or unregistering a host with Repomanager
  • Sending general host information to Repomanager
  • Sending package information of a host to Repomanager
  • Retrieving the configuration of a host profile from Repomanager

API key

An API key can be retrieved from Repomanager user space. Once generated, copy the key and keep it safe. This key is used to authenticate with the API and to perform certain actions when there is no host Id+token pair available.

If a new API key is generated, then all old keys become invalid and unusable.

Paths

API URL: https://FQDN/api/v2

Path Method Authentication JSON param(s) Description Example
/host/registering POST apikey:<APIKEY>
hostname:<FQDN> (required)
ip:<IP> (required)
Register host to Repomanager curl -X POST -d '{"apikey":"ak_QSXER8PZU70aNVvpilxy4IbDnG1JgFj3","hostname":"<FQDN>","ip":"<IP>"}' https://repomanager.mydomain.net/api/v2/host/registering
/host/registering DELETE
id:<HOST_ID>
token:<HOST_TOKEN>
  Unregister host from Repomanager curl -X DELETE -d '{"id":"id_3266409042dcg63265e082ecf3779f7c","token":"20b9fad57027bdd4f9ee712554db89ab"}' https://repomanager.mydomain.net/api/v2/host/registering
/host/status PUT
id:<HOST_ID>
token:<HOST_TOKEN>
hostname (optional)
os (optional)
os_version (optional)
os_family (optional)
type (=virtualization type) (optional)
kernel (optional)
arch (optional)
profile (optional)
env (optional)
agent_status (optional)
linupdate_version (optional)
reboot_required (optional)
Send host general informations to Repomanager  
/host/packages/installed PUT
id:<HOST_ID>
token:<HOST_TOKEN>
installed_packages (required) Send list of installed packages to Repomanager  
/host/packages/available PUT
id:<HOST_ID>
token:<HOST_TOKEN>
available_packages (required) Send list of available packages updates to Repomanager  
/host/packages/event PUT
id:<HOST_ID>
token:<HOST_TOKEN>
events (required) Send packages event history to Repomanager  
/profile GET
apikey:<APIKEY>
or
id:<HOST_ID>
token:<HOST_TOKEN>
  Retrieve all available profiles configuration curl -X GET -d '{"id":"id_3266409042dcg63265e082ecf3779f7c","token":"20b9fad57027bdd4f9ee712554db89ab"}' https://repomanager.mydomain.net/api/v2/profile | jq
/profile/<PROFILE> GET
apikey:<APIKEY>
or
id:<HOST_ID>
token:<HOST_TOKEN>
token:<HOST_TOKEN>
  Retrieve profile's global configuration curl -X GET -d '{"id":"id_3266409042dcg63265e082ecf3779f7c","token":"20b9fad57027bdd4f9ee712554db89ab"}' https://repomanager.mydomain.net/api/v2/profile/db_server | jq
/profile/<PROFILE>/excludes GET
apikey:<APIKEY>
or
id:<HOST_ID>
token:<HOST_TOKEN>
  Retrieve profile's package exclusion configuration curl -X GET -d '{"id":"id_3266409042dcg63265e082ecf3779f7c","token":"20b9fad57027bdd4f9ee712554db89ab"}' https://repomanager.mydomain.net/api/v2/profile/db_server/excludes | jq
/profile/<PROFILE>/repos GET
apikey:<APIKEY>
or
id:<HOST_ID>
token:<HOST_TOKEN>
  Retrieve profile's repositories configuration curl -X GET -d '{"id":"id_3266409042dcg63265e082ecf3779f7c","token":"20b9fad57027bdd4f9ee712554db89ab"}' https://repomanager.mydomain.net/api/v2/profile/db_server/repos | jq