Capabilities API

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.

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"\
    }\
  }\
]

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.

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.

Search results

No results found