Component Claim REST API - v2

NEW IN RELEASE 85

The component claim REST API allows you to

Note that in IQ Server's UI the Component Information Panel claim tab currently only supports viewing and claiming components in the maven format. As such, viewing, adding, updating, and removing component claims in formats other than maven is currently only supported via this API.

GET a Component Claim by Component Hash

To get a component's claim, you can issue a GET request to the following path

GET /api/v2/claim/components/{componentHash}

where componentHash is the SHA1 hash of the component.

Below is an example request to a local IQ Server using the built-in administrator account and the cURL tool

curl -u admin:admin123 http://localhost:8070/api/v2/claim/components/4632184fe1d932764efe

If a component claim does not exist for the given component hash, then the request yields HTTP status code 404. Otherwise a JSON response will be returned with the following properties

PropertyDescription
hash 

The truncated SHA1 hash of the component.

comment The comment left (if any) when claiming the component.
createTime 

The date and time when the component was created/published, defining the age of the component.

Note that this timestamp is not to be confused with the moment when the component claim was made.

componentIdentifier The format and coordinates for the claimed component.
packageUrl The package URL for the claimed component.

The following is an example successful response

{
    "hash": "4632184fe1d932764efe",
    "comment": "c1",
    "createTime": "2020-02-14T00:00:00.000Z",
    "componentIdentifier": {
        "format": "maven",
        "coordinates": {
            "artifactId": "a",
            "classifier": "c",
            "extension": "e",
            "groupId": "g",
            "version": "v"
        }
    },
    "packageUrl": "pkg:maven/g/a@v?classifier=c&type=e"
}

GET all Component Claims

To get all component claims, a Policy Administrator can issue a GET request to the following path

GET /api/v2/claim/components

Below is an example request to a local IQ Server using the built-in administrator account and the cURL tool

curl -u admin:admin123 http://localhost:8070/api/v2/claim/components

The following is an example successful response

{
    "componentClaims": [
        {
            "hash": "4632184fe1d932764efe",
            "comment": "c1",
            "createTime": "2020-02-14T00:00:00.000Z",
            "componentIdentifier": {
                "format": "maven",
                "coordinates": {
                    "artifactId": "a",
                    "classifier": "c",
                    "extension": "e",
                    "groupId": "g",
                    "version": "v"
                }
            },
            "packageUrl": "pkg:maven/g/a@v?classifier=c&type=e"
        },
        {
            "hash": "6d0684d8acf85cd6e7f2",
            "comment": "c2",
            "createTime": "2020-01-09T15:01:10.000Z",
            "componentIdentifier": {
                "format": "a-name",
                "coordinates": {
                    "name": "n",
                    "qualifier": "q",
                    "version": "v"
                }
            },
            "packageUrl": "pkg:a-name/n@v?qualifier=q"
        }
    ]
}

POST/Add/Update a Component Claim

To add or update a component claim, a Policy Administrator can issue a POST request to the following path

POST /api/v2/claim/components

The request requires a JSON body/payload, using the same properties described above, and must include at least a hash and a valid componentIdentifier / packageUrl.

Below is an example request to a local IQ Server using the built-in administrator account and the cURL tool

curl -u admin:admin123 -X POST -H "Content-Type: application/json" -d '{"hash":"a4d45b211072d89c0e54","comment":"c3","createTime":"2020-01-09T15:01:10.000Z","componentIdentifier":{"format":"npm","coordinates":{"packageId":"p","version":"v"}}}' http://localhost:8070/api/v2/claim/components

The following is an example successful response

{
    "hash": "a4d45b211072d89c0e54",
    "comment": "c3",
    "createTime": "2020-01-09T15:01:10.000Z",
    "componentIdentifier": {
        "format": "npm",
        "coordinates": {
            "packageId": "p",
            "version": "v"
        }
    },
    "packageUrl": "pkg:npm/p@v"
}

DELETE a Component Claim by Component Hash

To delete a component claim, you can issue a DELETE request to the following path

DELETE /api/v2/claim/components/{componentHash}

where componentHash is the SHA1 hash of the component. If a component claim does not exist for the given component hash, then the request yields HTTP status code 404.

Below is an example request to a local IQ Server using the built-in administrator account and the cURL tool

curl -X DELETE -u admin:admin123 http://localhost:8070/api/v2/claim/components/6d0684d8acf85cd6e7f2