Downloading JBoss from the Red Hat Customer Portal via API involves a process that combines authentication, API interaction, and file retrieval. While there is no direct API endpoint specifically for downloading JBoss software, you can use the Red Hat APIs to manage subscriptions, access product information, and potentially retrieve download links. Here is a comprehensive guide to achieve this:
Before you begin, ensure you have the following:
curl
or a similar HTTP client for making API calls.
jq
for processing JSON responses (install using
sudo yum install jq
on RHEL-based systems).
requests
.
Red Hat APIs use OAuth 2.0 for authorization. You need to generate an access token using your offline token.
https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token
POST
Content-Type: application/x-www-form-urlencoded
grant_type=refresh_token
client_id=rhsm-api
refresh_token=<your_offline_token>
curl -X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=refresh_token" \
-d "client_id=rhsm-api" \
-d "refresh_token=<your_offline_token>" \
https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expires_in": 1800,
"refresh_expires_in": 2592000,
"token_type": "Bearer",
"not-before-policy": 0,
"scope": "openid"
}
Save the access_token
from the response for subsequent API calls.
Use the access token to list available APIs and gather information about your subscriptions and products.
https://api.access.redhat.com/management/v1/apis
GET
Authorization: Bearer <access_token>
curl -X GET \
https://api.access.redhat.com/management/v1/apis \
-H "Authorization: Bearer <access_token>"
https://api.access.redhat.com/management/v1/subscriptions
GET
Authorization: Bearer <access_token>
curl -X GET \
https://api.access.redhat.com/management/v1/subscriptions \
-H "Authorization: Bearer <access_token>"
https://api.access.redhat.com/management/v1/products
GET
Authorization: Bearer <access_token>
curl -X GET \
https://api.access.redhat.com/management/v1/products \
-H "Authorization: Bearer <access_token>"
While there is no direct API to download JBoss, you can use the product information endpoints to potentially find download links. The exact URL for the JBoss version you want to download is typically available in the Red Hat Customer Portal under the product downloads section.
Alternatively, you can use the Red Hat API to list available downloads, although specific endpoints for JBoss downloads are not explicitly documented.
curl -X GET \
-H "Authorization: Bearer <access_token>" \
https://access.redhat.com/api/downloads/<jboss_product_id>
{
"downloads": [
{
"id": "jboss-eap-7.4.0",
"name": "JBoss EAP 7.4.0",
"download_url": "https://access.redhat.com/downloads/content/jboss-eap-7.4.0.zip"
}
]
}
Note the download_url
for the desired JBoss version.
Once you have the download URL, you can use curl
to download the file. Ensure that the Authorization
header includes your access token.
curl -L \
-H "Authorization: Bearer <access_token>" \
-o jboss-eap-7.4.0.zip \
"https://access.redhat.com/downloads/content/jboss-eap-7.4.0.zip"
This command uses the -L
flag to follow redirects and saves the downloaded file as jboss-eap-7.4.0.zip
.
To automate the process, you can create a script (e.g., in Bash or Python) that:
#!/bin/bash
# Variables
OFFLINE_TOKEN="<your_offline_token>"
TOKEN_URL="https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token"
DOWNLOAD_URL="https://access.redhat.com/downloads/content/jboss-eap-7.4.0.zip"
OUTPUT_FILE="jboss-eap-7.4.0.zip"
# Get Access Token
ACCESS_TOKEN=$(curl -s -X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=refresh_token" \
-d "client_id=rhsm-api" \
-d "refresh_token=$OFFLINE_TOKEN" \
$TOKEN_URL | jq -r '.access_token')
# Download JBoss
curl -L \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-o $OUTPUT_FILE \
$DOWNLOAD_URL
echo "Download complete: $OUTPUT_FILE"
After downloading, verify the integrity of the file using checksums provided on the Red Hat Customer Portal.
Red Hat provides Swagger documentation for their APIs, which can be found on the Red Hat API Tokens and Swagger documentation page. This documentation can be imported into REST clients like Postman or RESTlet to automatically build a library of API calls.
jq
to process JSON objects, which can be helpful for parsing API responses.
While direct downloading of JBoss via a dedicated API endpoint is not explicitly supported, you can use the Red Hat APIs to manage your subscriptions, access product information, and potentially retrieve download links. Always refer to the official Red Hat documentation for the most current and detailed information. For further details, you can visit Getting started with Red Hat APIs - Red Hat Customer Portal.