Component Labels REST API - v2

NEW IN RELEASE 1.48

The Component Labels API assigns or removes labels for components in the context of an application or organization:

Assigning Application Component Labels

Assigning an application component label requires the component hash, label name, and internal application ID for the component label.

Construct a POST REST request with the following path:

  • componentHash - A sha1 hash of the component, which can be found in the source repository.
  • labelName - The name of an existing label that can be applied to the application.
  • applicationId - The internal ID of the application.  Obtained from an 'applications' REST API call with:  GET /api/v2/applications?publicId={YourPublicId} .
POST /api/v2/components/{componentHash}/labels/{labelName}/applications/{applicationId}

The server will respond with a 204 status upon success.

An example assigning the application component label "Architecture-Deprecated":

curl -u admin:admin123 -X POST 'http://localhost:8070/api/v2/components/1249e25aebb15358bedd/labels/Architecture-Deprecated/applications/5065550c24514129bf66f9afd5c7be60'

Assigning Organization Component Labels 

NEW IN RELEASE 81

Component labels can also be assigned at the level of an organization in which case the component label is visible to all applications within that organization. The REST request for this operation is mostly identical to the one above for applications apart from the last path segments that rather denote the target organization instead of an application:

POST /api/v2/components/{componentHash}/labels/{labelName}/organizations/{organizationId}

To obtain the ID of the organization, you can use the organization REST API.

Removing Application Component Labels

Removing an application component label requires the component hash, label name, and internal application ID for the component label.

Construct a DELETE REST request with the following path:

  • componentHash - A sha1 hash of the component, which can be found in the source repository.
  • labelName - The name of an existing label that can be applied to the application.
  • applicationId - The internal ID of the application.  Obtained from an 'applications' REST API call.
DELETE /api/v2/components/{componentHash}/labels/{labelName}/applications/{applicationId}

The server will respond with a 204 status upon success.

An example removing the application component label "Architecture-Deprecated":

curl -u admin:admin123 -X DELETE 'http://localhost:8070/api/v2/components/1249e25aebb15358bedd/labels/Architecture-Deprecated/applications/5065550c24514129bf66f9afd5c7be60'

Removing Organization Component Labels 

NEW IN RELEASE 81

A component label that was assigned for an entire organization can be removed pretty much the same way as one for an application. The only difference to the above case is the specification of an organization ID instead of an application ID:

DELETE /api/v2/components/{componentHash}/labels/{labelName}/organizations/{organizationId}

Note that this operation strictly only changes the given organization and its very own component labels. Component labels that have been assigned in the context of individual applications within the organization are not affected.