.. _arbitrator-API-resources-v2-configs-credentials:

``/v2/configs/credentials`` 
----------------------------

	
.. tabularcolumns:: |p{1.5cm}|p{5cm}|p{8.5cm}|

+--------+-----------------------------+--------------------------------------------+
| Method | URL                         | Description                                |
+========+=============================+============================================+
| GET    | ``/v2/configs/credentials`` | Retrieves current list of all credentials. |
+--------+-----------------------------+--------------------------------------------+
| POST   | ``/v2/configs/credentials`` | Adds a new credential.                     |
+--------+-----------------------------+--------------------------------------------+
| PUT    | ``/v2/configs/credentials`` | Modifies an existing credential.           |
+--------+-----------------------------+--------------------------------------------+
| DELETE | ``/v2/configs/credentials`` | Deletes an existing credential.            |
+--------+-----------------------------+--------------------------------------------+

Header (required)
.................


``x-lxt-api-token``: "token from login"

GET
......

``/v2/configs/credentials``

* Example 1: Get All Credentials

  Command:

  ::

     curl -s 
          -H "x-lxt-api-token:eyJ0eXAiOiJKV1QiLCJh[...]
          --insecure 
          -w "RESP_CODE: %{response_code}"
          -X GET https://10.13.37.14/api/v2/configs/credentials


  Output (formatted):

  ::
     
     {"status": 200,
      "message": "Success",
      "data": [{"credential_id": "E613X4TEDYG[...]",
                "name": "ray",
                "username": "LayerX does not return usernames.",
                "password": "LayerX does not return passwords.",
                "profiles": [],
                "response_methods": []},
               {"credential_id":"HWO7ZVMUDG7SGWY7[...]",
                "name": "run.sh",
                "username": "LayerX does not return usernames.",
                "password": "LayerX does not return passwords.",
                "profiles": [],
                "response_methods": [] }
             ]
     }


  RESP_CODE: ``200``



POST
........

``/v2/configs/credentials``

Input Data

This is an example input object describing a single Credential.

::

   {"name": "admin2",
    "username": "admin2User",
    "password": "admin2Pass" }


* Example 1: POST probe group and probes

  Command:

  ::

     curl -s 
          -H "x-lxt-api-token:eyJ0eXAiOiJKV1QiLCJh[...]
          --insecure 
          -w "RESP_CODE: %{response_code}" 
          -d@test_data/credential 
          -X POST https://10.13.37.14/v2/configs/credentials


  Output (formatted):

  ::

     {"status": 200,
      "message": "Success",
      "data": [{"credential_id":"IZP3WG47RN66R0AR1[...]",
                "name":"admin2",
                "username":"LayerX does not return usernames.",
                "password":"LayerX does not return passwords.",
                "profiles":[],
                "response_methods":[] } ]
     }



  RESP_CODE: ``200``



PUT
......

``/v2/configs/credentials``

* Example 3: PUT credentials: Modify Credential


  Input data

  ::

     {"credential_id":"IZP3WG47RN66R0AR[...]",
      "name":"New Name" }


  Command:

  ::

     curl -s 
          -H "x-lxt-api-token: xxx" 
          --insecure 
          -w "RESP_CODE: %{response_code}" 
          -d@test_data/credential1 
          -X POST https://<IP or FQDN>/v2/configs/credentials


  ie.

  ::

     curl -s 
          -H x-lxt-api-token:eyJ0eXAiOiJKV1QiLCJhb[...]
          --insecure
          -w "RESP_CODE: %{response_code}" 
          -d@test_data/credential1 
          -X POST https://10.13.37.14/v2/configs/credentials


  Output (formatted):

  ::

     {"status": 200,
      "message": "Success",
      "data": [{"credential_id":"IZP3WG47RN66R0AR16110[...]",
                "name":"New Name"
                "username":"LayerX does not return usernames.",
                "password":"LayerX does not return passwords.",
                "profiles":[],
                "response_methods":[] } ]
     }



  RESP_CODE: ``200``



DELETE
.......


``/v2/configs/credentials``

* Example 1: Delete Credentials

  Input Data

  ::

     {"credential_id": "d9506ab97e091007a74[...]"}

  Command

  ::

     curl -s 
          -H x-lxt-api-token:eyJ0eXAiOiJKV1Q[...]
          --insecure 
          -w RESP_CODE: %{response_code} 
          -d@./test/input_data.json 
          -X DELETE https://10.13.37.14/api/v2/configs/credentials


  or

  ::

     curl -s 
          -H x-lxt-api-token:eyJ0eXAiOiJKV1Qi[...]
          --insecure 
          -w RESP_CODE: %{response_code}
          -X DELETE https://10.13.37.14/api/v2/configs/credentials/d9506ab97e09[...]


  Output (formatted):

  ::

     {"status":null,
      "message":null,
      "data":[]}



  RESP_CODE: ``200``
