When using tools such as the Domino API or domino-python package, you'll usually use information such as project owner, project name, or other easy to find information in your calls. However, there are a few calls and functions that utilize your project's ID, or a Hardware Tier ID. For example, the Project Hardware API call, or app_publish() domino-python function. As a non-Admin user of Domino, this information may be a bit more difficult to locate.
There are two simple ways to get this information:
Find Project ID and Hardware Tiers through browser network activity
To find your Project ID
- In your browser, with your Domino project open, right-click in the browser window or tab and select Inspect.
- Click the Network tab in the panel that appears.
- Navigate to your Project's "Overview" dashboard (or, if you're already there, refresh the page)
- In the network trace results, find the entry with a Name that begins "findProjectByOwnerAndName?ownerName=". Click on this entry.
- Click on the Response tab in the panel that appears.
- The value listed under "id": corresponds to your project ID.
To find available Hardware Tiers for your Project
- In your browser, with your Domino project open, right-click in the browser window or tab and select Inspect.
- Click the Network tab in the panel that appears.
- Navigate to your Project's "Settings" page (or, if you're already there, refresh the page)
- In the network trace results, find the entry with a Name "hardwareTiers". Click on this entry.
- Click on the Response tab in the panel that appears.
- The results will give you a list of Hardware Tier IDs, Names, and other related information.
Find Project ID and Hardware Tiers via API calls
The following python script can be run as a Job or in a Workspace, and will give you both your project's ID and the hardware Tiers available for your project:
import requests
import os
# Get Domino environment variables
apiKey=os.getenv("DOMINO_USER_API_KEY")
owner=os.getenv("DOMINO_PROJECT_OWNER")
project=os.getenv("DOMINO_PROJECT_NAME")
# API call gets list of runs for project
projUrl=f'https://your-domino-url.com/v1/projects/{owner}/{project}/runs'
headers = {
'X-Domino-Api-Key': apiKey
}
x = requests.get(projUrl, headers=headers)
response=x.json()
# Return project id from first record
my_id = response['data'][0]['projectId']
print("Your Project ID is: ", my_id)
# API call gets hardware tiers available for a project
tierURL = f'https://your-domino-url.com/v4/projects/{my_id}/hardwareTiers'
y = requests.get(tierURL, headers=headers)
response2=y.json()
print("\nThe hardware tiers available for your project are:")
# Iterate through available hardware tiers and print
for index, responseItem in enumerate(response2):
print("id="+response2[index]['hardwareTier']['id']+", Hardware Tier Name="+response2[index]['hardwareTier']['name'])
The above will give you a result similar to:
Your Project ID is: 633c9ba226d46a3537b177da
The hardware tiers available for your project are:
id=small-k8s, Hardware Tier Name=Small
id=large-k8s, Hardware Tier Name=Large
id=medium-k8s, Hardware Tier Name=Medium
id=medium-k8s-clone, Hardware Tier Name=Medium-clone
id=gpu-k8s, Hardware Tier Name=GPU
id=gpu-small-k8s, Hardware Tier Name=GPU (small)
Comments
0 comments
Please sign in to leave a comment.