How to Integrate Backend Applications to Call fabric APIs - Fabric

Create System App

Create System App with the right set of roles. For details on how to create a System App, refer to creating API apps. Once the app is created, capture the app credentials including the associated authentication information. To do this, refer to the steps viewing API apps.

Generate Access Token

Generate an access token using the System App credentials, which include Authorization URL, Client ID, and Client Secret. This access token is required in the next step to access fabric APIs, such as Product Catalog, Offers, and more.

cURL

curl --location '<authorizationUrl>/v1/token' \
--header 'accept: application/json' \
--header 'cache-control: no-cache' \
--header 'content-type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'scope=s2s' \
--data-urlencode 'client_id=<clientId>' \
--data-urlencode 'client_secret=<clientSecret>'

Perform Login

Trigger the required fabric API, such as the Product Catalog API, to get items from the catalog. Use the generated access token in the Authorization header to authenticate the API request. Note: Some of the fabric APIs require higher levels of permissions to run successfully. Hence, it is crucial to create the System App with the appropriate set of roles in Step 1.

cURL

curl --location 'https://api.fabric.inc/v3/published-products/skus/<sku>?locale=<locale>' \
--header 'x-fabric-tenant-id: <Tenant-Id>' \
--header 'Authorization: Bearer <Generated-access-token>'