Loading

How to get asset information from Exchange using Exchange Experience API

게시 일자: Mar 2, 2024
과업

GOAL

This article explains on how to get asset information from Exchange using the Exchange Experience API.
This article is useful when you required this data to do other API calls which are related to the Assets.
단계

Step 1: Retrieve the Authorization Token  

Please refer the knowledge article "How to generate your Authorization Bearer token for Anypoint Platform".

Step 2: Retrieve the Organization ID 

By using the Authorization Token from Step 1, execute the below API 

curl -H "Authorization: Bearer AUTH_TOKEN" https://anypoint.mulesoft.com/accounts/api/me

Below is the output snippet from the above API call, "id" field contains the Organization ID value. 

"organization": { 
"name": "user.name", 
"id": "xxxx-yyyy-zzzzz-vvvv"
}

Note: values in the above snippet output is masked. Use it as a reference only.

Step 3: Get your Assets' information

By using the Authorization Token and Organization ID from Step 1 & 2, execute the below API call
curl -v -X GET -H "Authorization: bearer <AUTH_TOKEN>" -H "Content-Type: application/json" 
"https://anypoint.mulesoft.com/exchange/api/v1/assets?organizationId=xxxx-yyyy-zzzzz-vvvv"
Note: values in the above snippet output is masked. Use it as a reference only.

You can use more than one organizationId as additional query parameters.
curl -v -X GET -H "Authorization: bearer <AUTH_TOKEN>" -H "Content-Type: application/json" 
"https://anypoint.mulesoft.com/exchange/api/v1/assets?organizationId=xxxx-yyyy-zzzzz-vvvv&organizationId=xxxx-yyyy-zzzzz-wwww"

You can also use the 'type' query parameter to filter the kind of assets you need to retrieve (i.e., connector, rest-api, etc.)
curl -v -X GET -H "Authorization: bearer <AUTH_TOKEN>" -H "Content-Type: application/json" 
"https://anypoint.mulesoft.com/exchange/api/v1/assets?organizationId=xxxx-yyyy-zzzzz-vvvv&organizationId=xxxx-yyyy-zzzzz-wwww&type=rest-api"

The most important information of the asset is the information that will help you to identify it: groupId, assetId & version.

Check this link to find out more information about getting information of an asset in Exchange Experience API.

Step 4: Get information of a specific version of an Asset

In order to get specific information of an asset's version, use the Authorization Token and Organization ID from Step 1 & 2 and the groupId, assetId and version from Step 3, execute the below API call:

curl -v -X GET -H "Authorization: bearer <AUTH_TOKEN>" -H "Content-Type: application/json"
"https://anypoint.mulesoft.com/exchange/api/v1/assets/{groupId}/{assetId}/{version}"

Check this link to find out more information about getting information of a specific version of an asset in Exchange Experience API.

Also refer the MuleSoft documentation to search Exchange asset using GRAPH API

Knowledge 기사 번호

001114921

 
로드 중
Salesforce Help | Article