API Explorer
API Explorer
Introduction
What's New
Appliance Management
Application Data Management
Asset Management
Asset Metadata
Authentication and Authorization
Cloud Disaster Recovery
Compliance
Copy Management
Credentials Management
Discovery
File Level Restore
Installation
Inventory Source Management
Kubernetes Data Management
Licenses Management
Location Management
Log Management
Monitoring
Protection Policies
Recovery and Reuse Management
Remote Service
Search Clusters
Secrets Manager
Server Disaster Recovery
Storage Management
Telemetry Setting
Upgrade
User Security Management
Virtual Machine Data Management
Whitelist Management

Delete Credentials

This tutorial describes how to delete credentials on PowerProtect Data Manager. The following APIs are used:

REST API Description
POST /api/v2/login Log in to the system.
GET /api/v2/credentials?filter=name eq {credential-name} Get a credential by name.
GET /api/v2/credentials/{id}/usage Get a list of consumers who are using the specified credential.
POST /api/v2/credentials-deletion-batch Delete multiple credentials in one batch.

For each credential on PowerProtect Data Manager, no (0) or multiple consumers may be using it. Only credentials with a consumer count of 0 can be deleted. The following example shows how to delete multiple credentials using the batch deletion API. This API allows partial success if some of the selected credentials do not meet the deletion criteria.

Login

Use the login API to retrieve the access token. See the tutorial for authentication and authorization.

Get credential ID

For a specified credential name, retrieve the credential ID:

GET /api/v2/credentials?filter=name eq {credential-name}

Sample response:

OK (200)

{
  "id": "36db1d89-281c-4c75-8683-3240fb96a19f",
  "name": "dd-cred-1",
  ...
}

The id identifies a specific credential.

Get the credential consumers count

A credential is used by 0 or multiple consumers. You can delete only the credentials that are not used by any consumer. You can retrieve a credential by its name or ID:

GET /api/v2/credentials?filter=name eq {credential-name}
GET /api/v2/credentials/{id}

The id is the credential ID that is retrieved from the previous step.

Sample response:

OK (200)

{
  "id": "36db1d89-281c-4c75-8683-3240fb96a19f",
  "name": "dd-cred-1",
  "username": "dd-cred-1",
  "password": null,
  "type": "DATADOMAIN",
  "method": null,
  "secretId": "cd5cdb25-1261-40b8-93fd-10af58d6c008",
  "internal": false,
  "consumersCount": 2,
  ...
}

The consumersCount is the number of consumers who are using this credential.

Get detailed consumer credential information

For a given credential, you can retrieve detailed consumer information:

GET /api/v2/credentials/{id}/usage

The id is the credential ID that is retrieved from a previous step.

Sample response:

OK (200)

{
  "consumersCount": 7,
  "consumerList": [
    {
      "type": "ASSETS",
      "label": "Assets",
      "consumers": [
        {
          "name": "asset-1",
          "id": "899d0a5a-9ce7-4d93-8ac8-5465e70b759c"
        },
        {
          "name": "asset-2",
          "id": "bbdcaaa0-108c-49e4-9be8-86b7f4f69850"
        }
      ]
    },
    {
      "type": "PROTECTION_POLICIES",
      "label": "Protection Policies",
      "consumers": [
        {
          "name": "protection-policy-1",
          "id": "bc6a5bce-0cf1-4b50-83c7-c7b86a4ab56d"
        }
      ]
    },
    {
      "type": "INVENTORY_SOURCES",
      "label": "Asset Sources",
      "consumers": [
        {
          "name": "inventory-source-1",
          "id": "bc6a5bce-0cf1-4b50-83c7-c7b86a4ab56e"
        }
      ]
    },
    {
      "type": "HOSTS",
      "label": "Asset Sources",
      "consumers": [
        {
          "name": "host-1",
          "id": "bc6a5bce-0cf1-4b50-83c7-c7b86a4ab56i"
        }
      ]
    },
    {
      "type": "STORAGE_SYSTEMS",
      "label": "Storage",
      "consumers": [
        {
          "name": "storage-1",
          "id": "bc6a5bce-0cf1-4b50-83c7-c7b86a4ab56g"
        }
      ]
    },
    {
      "type": "DATADOMAIN_MTREES",
      "label": "Storage Units",
      "consumers": [
        {
          "name": "storage-unit-1",
          "id": "bc6a5bce-0cf1-4b50-83c7-c7b86a4ab56h"
        }
      ]
    }
  ]
}

The consumers are categorized by type. In this example, seven consumers from six consumer types are using this credential.

Delete multiple credentials in one batch

Delete multiple credentials by specifying a list of credential IDs:

POST /api/v2/credentials-deletion-batch

Sample request body:

{
  "requests":[
    {
      "id":"1",
      "body": {
        "id": "4ade97c4-1b09-44a7-9f4e-fc6f86038660"
      }
    },
    {
      "id":"2",
      "body": {
        "id": "0d19a5f7-12ce-410b-9131-292c2ec541d7"
      }
    }
  ]
}

Each id that occurs within a body object is a credential ID that is retrieved from previous steps.

Sample responses:

Successfully deleted all the credentials (204)

204 means that all credentials provided in the ID list are successfully deleted.

Successfully deleted a part of the credentials (207)

{
  "response": [
    {
      "id": "1",
      "status": 204
    },
    {
      "id": "2",
      "status": 500,
      "body": {
        "reason": "This resource xxx is in use and cannot be deleted.",
        "remediation": null,
        "timestamp": 1603787412226,
        "path": "/api/v2/credentials/bbdcaaa0-108c-49e4-9be8-86b7f4f69850"
      }
    }
  ]
}

207 means that some of the credentials provided in the ID list do not meet the deletion criteria. The batch deletion is partially successful.