Skip to main content

Capabilities API

These REST API endpoints are used to manage capabilities for Nexus Repository. The user needs access to read and edit the nexus:settings permissions. Capabilities differ in their required properties. Review the capabilities documentation for list of capabilities, types, and properties.

See Capabilities

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": "firewall.audit",
    "notes": "",
    "enabled": false,
    "properties": {
      "quarantine": "true",
      "repository": "npm-proxy"
    }
  }
]

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":"firewall.audit",
    "enabled":"true",
    "notes": "",
    "properties": {
        "repository":"npm-proxy", 
        "quarantine":"true"
    }}'
  -X POST http://localhost:8081/service/rest/v1/capabilities 

Update 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.