Updating an application definition by using the Application PATCH API

You can update an application definition programmatically by using the Application PATCH API. This method allows you to add or remove application associations, such as build artifacts or source repositories, without modifying or re-uploading the application SBOM.

Before you begin

Ensure that you have the following information:
  • The Concert API endpoint, for example: https://your_concert_host/concert
  • A valid C_API_KEY for authentication.
  • The name of the application that you want to update (for example, myapp1).

Get the application ID

Search for the application by name to retrieve its ID.
curl -X GET \
  -H 'Authorization: C_API_KEY YOUR_BASE64_ENCODED_API_KEY' \
  -H 'InstanceId: YOUR_INSTANCE_ID' \
  'https://YOUR_CONCERT_HOST/concert/core/api/v1/applications?search=myapp1' \
  -k

Example response:

The following example shows a truncated response for illustration purposes.
{
  ...
  "applications": [
    {
      "id": "a2244e03-713b-49da-847d-44e5450c208b",
      "name": "myapp1",
      ...
    }
    ...
  ]
  ...
}

Copy the id value from the response. You will use this ID in the following steps.

Get the current application associations

Retrieve the current application details to identify the build artifacts or source repositories that are associated with the application.
curl -X GET \
  -H 'Authorization: C_API_KEY YOUR_BASE64_ENCODED_API_KEY' \
  -H 'InstanceId: YOUR_INSTANCE_ID' \
  'https://YOUR_CONCERT_HOST/concert/core/api/v1/applications/<application-id>' \
  -k
Note: In some virtual machine (VM) deployments of Concert, the instance ID is fixed to 0000-0000-0000-0000. If you are using a VM deployment, replace YOUR_INSTANCE_ID with this value.

Example response:

The following example shows a truncated response for illustration purposes.
{
  "id": "a2244e03-713b-49da-847d-44e5450c208b",
  "name": "myapp1",
  "associations": {
    "build_artifacts": [
      {
        "id": "c703a9af-368c-4135-8d1f-abd99d424007",
        "name": "us.icr.io/myapp/my-component-1",
        ...
      }
    ],
    "source_repos": [
      {
        "id": "d8e4b5c6-479d-543e-b7f9-5c749f535e18",
        "name": "github.com/myorg/myrepo",
        ...
      }
    ]
    ...
  }
  ...
}

Copy the id of the build artifacts or source repositories that you want to manage.

Manage associations

Use the PATCH API to add or remove associations.

Delete a build artifact
curl -X PATCH \
  -H 'Authorization: C_API_KEY YOUR_BASE64_ENCODED_API_KEY' \
  -H 'InstanceId: YOUR_INSTANCE_ID' \
  -H 'Content-Type: application/json' \
  -d '{"delete_associations":{"build_artifacts":["artifact-id"]}}' \
  'https://YOUR_CONCERT_HOST/concert/core/api/v1/applications/<application-id>' \
  -k
Add a build artifact
curl -X PATCH \
  -H 'Authorization: C_API_KEY YOUR_BASE64_ENCODED_API_KEY' \
  -H 'InstanceId: YOUR_INSTANCE_ID' \
  -H 'Content-Type: application/json' \
  -d '{"associations":{"build_artifacts":["artifact-id"]}}' \
  'https://YOUR_CONCERT_HOST/concert/core/api/v1/applications/<application-id>' \
  -k
Add a build artifact
curl -X PATCH \
  -H 'Authorization: C_API_KEY YOUR_BASE64_ENCODED_API_KEY' \
  -H 'InstanceId: YOUR_INSTANCE_ID' \
  -H 'Content-Type: application/json' \
  -d '{"associations":{"build_artifacts":["artifact-id"]}}' \
  'https://YOUR_CONCERT_HOST/concert/core/api/v1/applications/<application-id>' \
  -k
Delete a source repository
curl -X PATCH \
  -H 'Authorization: C_API_KEY YOUR_BASE64_ENCODED_API_KEY' \
  -H 'InstanceId: YOUR_INSTANCE_ID' \
  -H 'Content-Type: application/json' \
  -d '{"delete_associations":{"source_repos":["repo-id"]}}' \
  'https://YOUR_CONCERT_HOST/concert/core/api/v1/applications/<application-id>' \
  -k
Add a source repository
curl -X PATCH \
  -H 'Authorization: C_API_KEY YOUR_BASE64_ENCODED_API_KEY' \
  -H 'InstanceId: YOUR_INSTANCE_ID' \
  -H 'Content-Type: application/json' \
  -d '{"associations":{"source_repos":["repo-id"]}}' \
  'https://YOUR_CONCERT_HOST/concert/core/api/v1/applications/<application-id>' \
  -k

Add and remove associations in a single request

You can add and delete multiple associations in a single API request.
curl -X PATCH \
  -H 'Authorization: C_API_KEY YOUR_BASE64_ENCODED_API_KEY' \
  -H 'InstanceId: YOUR_INSTANCE_ID' \
  -H 'Content-Type: application/json' \
  -d '{
    "associations": {
      "build_artifacts": ["new-artifact-id-1", "new-artifact-id-2"],
      "source_repos": ["new-repo-id-1"]
    },
    "delete_associations": {
      "build_artifacts": ["old-artifact-id-1"],
      "source_repos": ["old-repo-id-1"]
    }
  }' \
  'https://YOUR_CONCERT_HOST/concert/core/api/v1/applications/<application-id>' \
  -k
Note:
  • The API requires IDs (UUIDs) of build artifacts and source repositories, not their names.
  • Always retrieve the application details first to obtain the correct IDs.
  • After making updates, retrieve the application details again to verify that the associations were updated.
If you receive an Internal Server Error, verify the following:
  • You are using valid UUIDs (not names or encoded values).
  • The application ID is correct.
  • Your API authentication is valid.

Quick reference for updating application associations

You can use the following request fields when updating application associations through the Application Patch API.
Table 1. Fields used for updating application associations
Action Field to use
Add associations "associations": {"build_artifacts": [...], "source_repos": [...]}
Remove associations "delete_associations": {"build_artifacts": [...], "source_repos": [...]}
Add and remove associations in the same request Include both associations and delete_associations fields

Example workflow for updating associations by using the API

The following example shows a simplified workflow that retrieves the application ID and then updates the application associations.

Note: This example uses the jq command-line JSON processor to parse the API response.
# Set your API key
API_KEY="YOUR_BASE64_ENCODED_API_KEY"

# 1. Find the application ID
APP_ID=$(curl -X GET \
  -H "Authorization: C_API_KEY $API_KEY" \
  -H 'InstanceId: YOUR_INSTANCE_ID' \
  'https://YOUR_CONCERT_HOST/concert/core/api/v1/applications?search=myapp1' \
  -k -s | jq -r '.applications[0].id')

# 2. Get the current application associations
curl -X GET \
  -H "Authorization: C_API_KEY $API_KEY" \
  -H 'InstanceId: YOUR_INSTANCE_ID' \
  "https://YOUR_CONCERT_HOST/concert/core/api/v1/applications/$APP_ID" \
  -k

# 3. Delete a build artifact (replace with the actual artifact ID)
curl -X PATCH \
  -H "Authorization: C_API_KEY $API_KEY" \
  -H 'InstanceId: YOUR_INSTANCE_ID' \
  -H 'Content-Type: application/json' \
  -d '{"delete_associations":{"build_artifacts":["ARTIFACT_ID_HERE"]}}' \
  "https://YOUR_CONCERT_HOST/concert/core/api/v1/applications/$APP_ID" \
  -k