Update a credential

Send a PUT request to update the credential name or description, attribute name or description, input type, value masking, or password flagging.

Prerequisites

JSON Web Token (JWT)
All Control Room APIs require a JSON Web Token (JWT) to access the APIs. Generate an authentication token using the Enterprise 11 Authentication API.
Permissions
You must be the owner of a credential to update credential properties.
Note:
  • Use the Swagger definition files installed with your Control Room to test the APIs. View the available Swagger APIs at http://<your_control_room_url>/swagger/.
  • You can also use a REST client to complete this task.

Procedure

  1. Add an authentication token to the request header.
    Note: Use the Enterprise 11 Authentication API to generate a JSON Web Token.
  2. Specify the method and URL.
    • Method: PUT
    • URL: http://<your_control_room_url>/v2/credentialvault/credentials/{id}
  3. Add the fields and values to update.
    Request body:
    {
    "name": "Email connection parameters",
      "description": "",
      "ownerId": "14",
      "attributes": [
        {
          "id": "61",
          "name": "outlook password",
          "description": "",
          "userProvided": true,
          "masked": false,
          "createdBy": "14",
          "createdOn": "2020-01-27T19:07:12.363Z",
          "updatedBy": "14",
          "updatedOn": "2020-01-27T19:07:12.363Z",
          "version": "2",
          "passwordFlag": true
        }
      ],
      "createdBy": "14",
      "createdOn": "2019-12-19T21:35:45.326Z",
      "updatedBy": "14",
      "updatedOn": "2020-01-27T19:07:12.364Z",
      "version": "4"
    }
  4. Send the request.
    • In a REST Client, click SEND.
    • In the Swagger interface, click Execute.
    The response for this example returns information on the new credential. The example response confirms the updated fields. It also contains the date and time of the update and the version. Each time the credential is updated, the version value increments by one.

    Response body:

    {
      "id": "12",
      "name": "Email connection parameters",
      "description": "",
      "ownerId": "14",
      "attributes": [
        {
          "id": "61",
          "name": "outlook password",
          "description": "",
          "userProvided": true,
          "masked": false,
          "createdBy": "14",
          "createdOn": "2020-01-27T19:09:19.560Z",
          "updatedBy": "14",
          "updatedOn": "2020-01-27T19:09:19.560Z",
          "version": "3",
          "passwordFlag": true
        }
      ],
      "createdBy": "14",
      "createdOn": "2019-12-19T21:35:45.326Z",
      "updatedBy": "14",
      "updatedOn": "2020-01-27T19:09:19.560Z",
      "version": "5"
    }
You can also run REST requests from a command terminal. Here is a Curl example of the request. This example is formatted for readability. Replace text inside the angel brackets with the appropriate values.
curl -X POST "<your_control_room_url>/v2/credentialvault/credentials"
                -H "accept: application/json" -H "X-Authorization: <authentication_token>"
                -H "Content-Type: application/json" -d "{ \"id\": \"<credential_id>\",
                \"name\": \"<credential_name>\", \"description\": \"<credential_description>\",
                \"ownerId\": \"<owner_id>\", \"attributes\": [], \"createdBy\": \"<user_id>\",
                \"createdOn\": \"<date_time>\", \"updatedBy\": \"<user_id>\",
                \"updatedOn\": \"<date_time>\", \"version\": \"<version_number>\"}"