Skip to main content

License Overrides REST API

Note

Releases 189 - 190 used the path api/v2/licenseOverride for this API. However, in release 191, we have updated the API to match Sonatype's naming convention. As of release 191, this API uses api/v2/licenseOverrides (with "Overrides" now plural).

Use the endpoints on this page to manage the license overrides for a component.

Methods Supported:

Change the License Overrides

You can update the license overrides using the POST method.

Permissions required: Change Licenses

POST /api/v2/licenseOverrides/{ownerType}/{ownerId}

The JSON payload consists of:

Field

Description

ownerID

The ID for the application, organization, or repository.

comment

The comment for license overrides.

licenseIds

A list of all license IDs to be updated.

componentIdentifier

The component identifier consisting of format and coordinates.

status

The status to be assigned to the component license.

Allowed values for status are OPEN, ACKNOWLEDGED, OVERRIDDEN, SELECTED, and CONFIRMED.

Example:

curl --location 'http://localhost:8070/api/v2/licenseOverrides/application/apptest' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic <USER_PASS_BASIC_TOKEN>' \
--data-raw '{
    "componentIdentifier": {
        "format": "a-name",
        "coordinates": {
            "name": "@microsoft/applicationinsights-teechannel-js",
            "qualifier": "",
            "version": "3.0.0-beta.2304-07"
        }
    },
    "comment": "This is a comment.",
    "licenseIds": ["123-OSO-MIT-PL-2.0", "42-Unlicense"],
    "status": "OVERRIDDEN"
}'

Response:

The response contains the updated license overrides status and the licenseOverrideID as id.

{
    "id": "a2449b221c394553865b93d276b0d2fc",
    "ownerId": "f575f8cec94445b29c564e2cec617e7f",
    "comment": "This is a comment.",
    "licenseIds": [
        "42-Unlicense",
        "123-OSO-MIT-PL-2.0"
    ],
    "componentIdentifier": {
        "format": "a-name",
        "coordinates": {
            "name": "@microsoft/applicationinsights-teechannel-js",
            "qualifier": "",
            "version": "3.0.0-beta.2304-07"
        }
    },
    "status": "OVERRIDDEN"
}

Retrieve the Overrides for Component License

Use the GET method to retrieve the license overrides for the component license, by specifying the component identifier.

Permissions required: View IQ Elements

GET /api/v2/licenseOverrides/{ownerType}/{ownerId}

Example:

curl --location --globoff 'http://localhost:8070/api/v2/licenseOverrides/application/apptest?componentIdentifier={%22format%22%3A%20%22a-name%22%2C%0A%20%20%20%20%20%22coordinates%22%3A%20{%0A%20%20%20%20%20%20%20%20%22name%22%3A%20%22%40microsoft%2Fapplicationinsights-teechannel-js%22%2C%0A%20%20%20%20%20%20%20%20%22qualifier%22%3A%20%22%22%2C%0A%20%20%20%20%20%20%20%20%22version%22%3A%20%223.0.0-beta.2304-07%22%0A%20%20%20%20%20%20}%0A%20%20%20}' \
--header 'Authorization: Basic <BASIC_TOKEN>'

Response

The response contains details for the overrides that were applied to the component license.

{
    "licenseOverridesByOwner": [
        {
            "ownerId": "apptest",
            "ownerName": "apptest",
            "ownerType": "application",
            "licenseOverride": {
                "id": "a2449b221c394553865b93d276b0d2fc",
                "ownerId": "f575f8cec94445b29c564e2cec617e7f",
                "status": "OVERRIDDEN",
                "comment": "This is a comment.",
                "licenseIds": [
                    "123-OSO-MIT-PL-2.0",
                    "42-Unlicense"
                ],
                "componentIdentifier": {
                    "format": "a-name",
                    "coordinates": {
                        "name": "@microsoft/applicationinsights-teechannel-js",
                        "qualifier": "",
                        "version": "3.0.0-beta.2304-07"
                    }
                }
            }
        },
        {
            "ownerId": "86d4db175f67424b99a2a7adc83df79e",
            "ownerName": "org3",
            "ownerType": "organization",
            "licenseOverride": null
        },
        {
            "ownerId": "ROOT_ORGANIZATION_ID",
            "ownerName": "Root Organization",
            "ownerType": "organization",
            "licenseOverride": {
                "id": "f15c58e5636044ceb6ef765a7d2bb35b",
                "ownerId": "ROOT_ORGANIZATION_ID",
                "status": "OVERRIDDEN",
                "comment": "This is a comment.",
                "licenseIds": [
                    "123-OSO-MIT-PL-2.0",
                    "42-Unlicense"
                ],
                "componentIdentifier": {
                    "format": "a-name",
                    "coordinates": {
                        "name": "@microsoft/applicationinsights-teechannel-js",
                        "qualifier": "",
                        "version": "3.0.0-beta.2304-07"
                    }
                }
            }
        }
    ]
}

Delete License Overrides

Use the DELETE method to remove license overrides for a component by specifying the licenseOverrideID. The licenseOverrideID can be retrieved using the GET method above.

Permisisons required: Change Licenses

DELETE /api/v2/licenseOverrides/{ownerType}/{ownerId}/{licenseOverrideId}

Example:

curl --location --request DELETE 'http://localhost:8070/api/v2/licenseOverrides/application/apptest/<LICENSE_OVERRIDE_ID>' \
--header 'Authorization: Basic <BASIC_TOKEN>'

Response

The response code 204 indicates that the license overrides were deleted successfully.