Import and map Traceable resources in Service Catalog

Uses: Service Catalog Konnect API
Related Documentation
Incompatible with
on-prem
TL;DR

Install the Traceable integration in Konnect and authorize it with your Traceable API key. Create a Service Catalog service and associate it with your Traceable services to display metadata and enable event tracking.

Prerequisites

If you don’t have a Konnect account, you can get started quickly with our onboarding wizard.

  1. The following Konnect items are required to complete this tutorial:
    • Personal access token (PAT): Create a new personal access token by opening the Konnect PAT page and selecting Generate Token.
  2. Set the personal access token as an environment variable:

    export KONNECT_TOKEN='YOUR KONNECT TOKEN'
    

You need the Integration Admin role in Konnect to install and authorize Service Catalog integrations.

You must have an active Traceable account and valid API access to connect Traceable services to your service. You also need a Traceable Service you can pull into Konnect.

Export your Traceable API key:

export TRACEABLE_API_KEY='YOUR-TRACEABLE-API-KEY'

Install and authorize the Traceable integration

Before you can ingest resources from Traceable, you must first install and authorize the Traceable integration.

First, install the Traceable integration:

 curl -X POST "https://us.api.konghq.com/v1/integration-instances" \
     -H "Authorization: Bearer $KONNECT_TOKEN" \
     --json '{
       "integration_name": "traceable",
       "name": "traceable",
       "display_name": "Traceable",
       "config": {
         "include_inactive": false
       }
     }'

Export the ID of your Traceable integration:

export TRACEABLE_INTEGRATION_ID='YOUR-INTEGRATION-ID'

Next, authorize the Traceable integration with your Traceable API key:

 curl -X POST "https://us.api.konghq.com/v1/integration-instances/$TRACEABLE_INTEGRATION_ID/auth-credential" \
     -H "Authorization: Bearer $KONNECT_TOKEN" \
     --json '{
       "type": "multi_key_auth",
       "config": {
         "headers": [
           {
             "name": "authorization",
             "key": "'$TRACEABLE_API_KEY'"
           }
         ]
       }
     }'

Once authorized, resources from your Traceable account will be discoverable in the UI.

Create a service in Service Catalog

Create a service that you’ll map to your Traceable resources:

 curl -X POST "https://us.api.konghq.com/v1/catalog-services" \
     -H "Authorization: Bearer $KONNECT_TOKEN" \
     --json '{
       "name": "billing",
       "display_name": "Billing Service"
     }'

Export the service ID:

export TRACEABLE_SERVICE_ID='YOUR-SERVICE-ID'

List Traceable resources

Before you can map your Traceable resources to a service in Service Catalog, you first need to find the resources that are pulled in from Traceable:

 curl -X GET "https://us.api.konghq.com/v1/resources?filter%5Bintegration.name%5D=traceable" \
     -H "Authorization: Bearer $KONNECT_TOKEN"

You might need to manually sync your Traceable integration for resources to appear. From the Konnect UI by navigating to the Traceable integration you just installed and selecting Sync Now from the Actions dropdown menu.

Export the resource ID you want to map to the service:

export TRACEABLE_RESOURCE_ID='YOUR-RESOURCE-ID'

Map resources to a service

Now, you can map the Traceable resource to the service:

 curl -X POST "https://us.api.konghq.com/v1/resource-mappings" \
     -H "Authorization: Bearer $KONNECT_TOKEN" \
     --json '{
       "service": "billing",
       "resource": "'$TRACEABLE_RESOURCE_ID'"
     }'

Validate the mapping

To confirm that the Traceable resource is now mapped to the intended service, list the service’s mapped resources:

 curl -X GET "https://us.api.konghq.com/v1/catalog-services/$TRACEABLE_SERVICE_ID/resources" \
     -H "Authorization: Bearer $KONNECT_TOKEN"
Something wrong?

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!