Search for credentials using filters

Send a POST request with filters to return a list of credentials that belong to a particular locker.

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.
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: POST
    • URL: http://<your_control_room_url>/v2/credentialvault/credentials/list
  3. Optional: Add the query parameter to only return the credentials that were configured as userProvided and you have used.
    http://<your_control_room_url>/v2/credentialvault/credentials/list?consumed=true
  4. Leave the request body blank to request information on all available credentials. Add filter parameters to the request body to limit the information returned from all the available credentials.
    Note: You can filter your results only using credential name.
    The example request body contains the following parameters:
    • Searches for a locker with the name: Email connection credentials.
    • Sorts the results by credential name.
    Request body:
    {
      "sort": [
        {
          "field": "name",
          "direction": "asc"
        }
      ],
      "filter": {
        "operator": "substring",
        "value": "Email connection credentials",
        "field": "name"
      },
      "fields": [
        
      ],
      "page": {
        "offset": 0,
        "total": 3,
        "totalFilter": 3,
        "length": 200
      }
    }
  5. Send the request.
    • In a REST Client, click SEND.
    • In the Swagger interface, click Execute.

    Response body: The response for this example returns information of credential name: Email connection credentials.

    {
      "page": {
        "offset": 0,
        "total": 3,
        "totalFilter": 1
      },
      "list": [
        {
          "id": "21",
          "name": "Email connection credentials",
          "description": "",
          "lockerId": "2",
          "ownerId": "14",
          "attributes": [
            {
              "id": "71",
              "name": "gmail password",
              "description": "",
              "userProvided": true,
              "masked": false,
              "createdBy": "14",
              "createdOn": "2020-01-24T18:18:44.132Z",
              "updatedBy": "14",
              "updatedOn": "2020-01-24T20:01:34.465Z",
              "version": "2",
              "passwordFlag": true
            }
          ],
          "createdBy": "14",
          "createdOn": "2020-01-24T18:18:44.132Z",
          "updatedBy": "14",
          "updatedOn": "2020-01-27T18:08:39.418Z",
          "version": "3",
          "completed": false
        }
      ]
    }
Note: You can also run REST requests from a command terminal. The following is a curl request example. This example is formatted for readability. Replace the text inside the angle brackets, <authentication_token>, with your authentication token.
curl -X POST "<your_control_room_url>/v1/repository/filefolder/list" -H "accept: application/json"
        -H "X-Authorization: <authentication_token>" -H "Content-Type: application/json"
        -d "{   
            \"fields\": [],
            \"filter\": {
                 \"field\": \"lockerId\", 
                 \"value\": \"2\"
                 },
            \"sort\": [ {
                \"field\": \"id\",
                \"direction\": \"asc\"
                } ],
            \"page\": { 
                \"offset\": 0,
                \"length\": 0 
            }}"