Capabilities API
Use these REST API endpoints to manage capabilities in Nexus Repository. To call them, you must have nexus:settings permissions with read and edit access. Capabilities differ in their required properties. For details, see the Capabilities documentation for the full list of capabilities, capability types, and their properties.
Note
Starting in Sonatype Nexus Repository 3.94.0, Firewall Audit and Quarantine is configured through the repository configuration payload instead of the Capabilities API. Do not use /service/rest/v1/capabilities to create or update Firewall Audit and Quarantine configuration in 3.94.0 or later. For current Firewall configuration steps, see Firewall Configuration for Nexus Repository.
Get Capabilities
The request returns a list of capabilities. The user requires the following permissions: (nexus:settings.read)
GET /service/rest/v1/capabilities
Example
curl -u admin:admin123 -X GET http://localhost:8081/service/rest/v1/capabilities
Example response
[
{
"id": "018b####-49##-30##-1e##-09347#######",
"type": "example-capability-type",
"notes": "",
"enabled": true,
"properties": {
"exampleProperty": "exampleValue"
}
}
]Note
Replace example-capability-type and exampleProperty with the capability type and required properties for the capability you want to create.
Get Capability Types
The purpose of this endpoint is to retrieve the available capability types along with their metadata, including form fields, descriptions, and configuration requirements. Users must have the nexus:capabilities:read permission to access this endpoint.
GET /v1/capabilities/types
Example
curl -u admin:admin123 -X GET http://localhost:8081/service/rest/v1/capabilities/types
Example response
[
{
"id": "baseurl",
"name": "Base URL",
"about": "HTML description of capability purpose",
"formFields": [
{
"id": "url",
"type": "url",
"label": "URL",
"helpText": "Reverse proxy base URL",
"required": true,
"initialValue": null,
"minValue": null,
"maxValue": null,
"storeApi": null,
"storeFilters": null,
"attributes": {}
}
]
}
]Create Capabilities
The user requires the following permissions: (nexus:settings.edit) The request to add a new capability is submitted in the body of a POST request. The endpoint will return a 201 when successful and a 409 when the name already exists.
POST /service/rest/v1/capabilities
{
"type": "string",
"notes": "string",
"enabled": true,
"properties": {
"additionalProp1": "string",
"additionalProp2": "string"
}
}The following parameters are included in the body of the request. Any that are not included as criteria in the request are set to null.
type- the type of capability to add.enabled- set to true to enable the capability.notes- any details on the specific capability.properties- an object of additional properties to send. See the capabilities documentation for details on the required properties to include for each capability.
Example Request
curl -u admin:admin123 \
-H 'accept:application/json' \
-H 'Content-Type: application/json' \
-d '{
"type": "example-capability-type",
"enabled": true,
"notes": "",
"properties": {
"exampleProperty": "exampleValue"
}
}' \
-X POST http://localhost:8081/service/rest/v1/capabilitiesUpdate Capability
The user requires the following permissions: (nexus:settings.edit) The request to update a capability with a PUT request. The endpoint will return a 201 when successful.
PUT /service/rest/v1/capabilities/{capabilityId}Use the GET endpoint to locate the id property to use as the capabilityId.
Remove Capability
The user requires the following permissions: (nexus:settings.delete) The request to remove a capability with a DELETE request. The endpoint will return a 201 when successful.
DELETE /service/rest/v1/capabilities/{capabilityId}Use the GET endpoint to locate the id property to use as the capabilityId.