Fetching Your Org ID with the Platform API
Overviewβ
Platform's API gives a user the opportunity to create and edit Fleets along with looking at historical runs. However, every API end point requires an org ID to call them. The only way to access your org ID is through the Platform API.
In this tutorial, we will walk through the steps needed to call the Platform API to get your org ID.
This tutorial will walk through the API call in Python, however you can call the API using the language of your choice.
Setupβ
All you need to get started with this tutorial is a Platform API key and a coding environment. To generate an API key, head over to the Platform API authorization page. For a coding environment, you are free to use your tool of choice such as Visual Studio Code or Hex.
Stepsβ
- Head over to your coding environment and paste the following code into your editor:
import requests
import json
api_key = 'YOUR_API_KEY'
headers = {
'X-Shipyard-API-Key': f'{api_key}',
}
response = requests.get('https://api.app.shipyardapp.com/orgs', headers=headers)
org = json.loads(response.text)
print(org['data'])
- Substitute your API key at the top of the script with the YOUR_API_KEY string.
- Run the script. The printed output should look like this:
- You are able to get your org ID from the value of the ID key in that dictionary.
You've successfully fetched your API key with the Platform API.