To interact with the Checkout APIs for Jira Cloud, you'll need to authenticate your requests using Basic Authentication. This method requires an API token and your email address.
Steps to Authenticate:
Generate an API Token:
Log in to your Jira Cloud account.
Navigate to Account Settings.
Select Security.
Click on Create and manage API tokens.
Generate a new API token and store it securely.
Prepare Your Credentials:
Combine your email address and API token in the format:
user@example.com:your_api_token
Encode Credentials in Base64:
Use a Base64 encoder to encode the combined string.
For example, in Python:
import base64 credentials = 'user@example.com:your_api_token' encoded_credentials = base64.b64encode(credentials.encode('utf-8')).decode('utf-8')
Include in HTTP Authorization Header:
Add the following header to your API requests:
Authorization: Basic encoded_credentials
Example:
If your email is user@example.com
and your API token is abcd1234
, your combined string is:
user@example.com:abcd1234
Encoded in Base64, this becomes (for illustration purposes):
dXNlckBleGFtcGxlLmNvbTphYmNkMTIzNA==
Your Authorization header will be:
Authorization: Basic dXNlckBleGFtcGxlLmNvbTphYmNkMTIzNA==
Using the AssetType REST Endpoint
The AssetType endpoint allows you to retrieve information about different asset types managed within Checkout.
Endpoint URL:
GET https://checkout.mumosystems.com/rest/checkout/1.0/assettype
Parameters:
This endpoint does not require any query parameters for a basic GET request.
Example Request Using cURL:
curl -X GET \ 'https://checkout.mumosystems.com/rest/checkout/1.0/assettype' \ -H 'Authorization: Basic dXNlckBleGFtcGxlLmNvbTphYmNkMTIzNA==' \ -H 'Content-Type: application/json
Example Response:
[ { "id": "1", "name": "Laptop", "description": "Portable computers" }, { "id": "2", "name": "Monitor", "description": "Display screens" }, { "id": "3", "name": "Keyboard", "description": "Input devices" } ]
The response is a JSON array of asset type objects, each containing:
id
: The unique identifier of the asset type.name
: The name of the asset type.description
: A brief description of the asset type.
Example Request Using Python and Requests Library:
import requests import base64 # Your credentials email = 'user@example.com' api_token = 'your_api_token' credentials = f'{email}:{api_token}' encoded_credentials = base64.b64encode(credentials.encode('utf-8')).decode('utf-8') # Headers headers = { 'Authorization': f'Basic {encoded_credentials}', 'Content-Type': 'application/json' } # API URL url = 'https://your-domain.atlassian.net/rest/checkout/1.0/assettype' # Send GET request response = requests.get(url, headers=headers) # Check response if response.status_code == 200: asset_types = response.json() print(asset_types) else: print(f'Error: {response.status_code} - {response.text}')