- Systems registered with Red Hat Subscription Management
- There is no supported API method yet. However, RHSM-web is backed by the Candlepin API.
REST API provides RHSM users a possible automation solution for virtual data centres and organizations that cycle through instances often.
NOTE Some of the calls will not work since they are filtered, but some of the calls will work because we do consume some of the candlepin endpoints.
A couple of simple examples of using curl to retrieve JSON data from the API
- Retrieve info about a consumer (authenticating using RHN username/password):
$ curl -s -u <rhn_username> -k https://subscription.rhn.redhat.com/subscription/consumers/<consumer_uuid> | python -mjson.tool
- Retrieve info about the entitlements for a consumer (authenticating using RHN username/password):
$ curl -s -u <rhn_username> -k https://subscription.rhn.redhat.com/subscription/consumers/<consumer_uuid>/entitlements | python -mjson.tool
- Retrieve all subscriptions for a consumer (authenticating using consumer cert/key):
$ curl --cert /etc/pki/consumer/cert.pem --key /etc/pki/consumer/key.pem -k 'https://subscription.rhn.redhat.com/subscription/pools?consumer=<consumer_uuid>&listall=true' | python -mjson.tool
Note In all the above cases the request is a GET request. The response is encoded in JSON format can be be processed further if desired. POST requests can be created with curl using the –data option (and in wget by using the –post-data option).
- Delete the systems from portal
$ curl -i -X DELETE http://subscription.rhn.redhat.com/subscription/consumers/<consumer_uuid>
- Update the entitlement information
$ curl -i POST http://subscription.rhn.redhat.com/subscription/entitlements/<entitlement_id>
- Attach subscription to a system
$ curl -vku <rhn_username> -X POST 'https://subscription.rhsm.redhat.com/subscription/consumers/<consumer_uuid>/entitlements?pool=<subscription pool_id>&quantity=1'
- Download manifest
curl -vku <rhn_username> 'https://subscription.rhsm.redhat.com/subscription/consumers/<consumer_uuid>/export' > manifest.zip
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.