Get the importSourceId used in Assets Rest API
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
The ImportSource endpoints related to the Assets REST API all use the importSourceId as path parameters to build the different API requests. This article provides two approaches to get this ID.
Solution
1. Get the values from the dynamic links that are generated from the imports
If you follow the Imports REST API Guide notice that on Steps 2 and 3 some links are generated after the container token is verified by making a GET request to the imports info endpoint in Assets:
GET https://api.atlassian.com/jsm/assets/v1/imports/info
Accept: application/json
Authorization: Bearer EXAMPLE_TOKEN
The links should have the following format:
{
"links": {
"getStatus": "https://api.atlassian.com/jsm/assets/workspace/4c24ff3f-eb30-45de-a46a-5a05e0d8cf25/v1/importsource/9a397226-ba27-437a-85f6-e1955baea8e6/configstatus",
"start": "https://api.atlassian.com/jsm/assets/workspace/4c24ff3f-eb30-45de-a46a-5a05e0d8cf25/v1/importsource/9a397226-ba27-437a-85f6-e1955baea8e6/executions",
"mapping": "https://api.atlassian.com/jsm/assets/workspace/4c24ff3f-eb30-45de-a46a-5a05e0d8cf25/v1/importsource/9a397226-ba27-437a-85f6-e1955baea8e6/mapping"
}
}
from where the importSourceId can be read from the URL path. So, for the example above, the importSourceId is 9a397226-ba27-437a-85f6-e1955baea8e6 and comes under the .../importsource/{importSourceId}/... of the path on each of the different links that is generated.
2. Create the External Import via the UI and use the Browser Developer Tools to fetch the value
Following the instructions in Create an import structure, you can, for example, perform a quick edit on the Import Structure to fetch the importSourceId by using your browser's Developer Tools' Network tab.
Check Generate HAR files for details on accessing your browser's Developer Tools.
View the importSourceId by editing the Import Structure
In your Schema, select Schema settings, then choose the Import tab.
Select an Import structure.
Select the ••• next to the Import Structure > Edit import structure.
Open the Developer Tools of your browser. Go to the Network tab.
Click on the Save button in your import structure settings.
Look for the request that starts with validateimportcreation(...) in the Network tab of the browser's DevTools.
In the payload tab, search for the importSourceId.

Was this helpful?