# Credentials API

## Get All Credentials for the Project

<mark style="color:blue;">`GET`</mark> `https://integrator.dckap.com/workspace/:project_id/api/credentials/get/all`

To retrieve all credentials information for the specified project.

#### Path Parameters

| Name        | Type   | Description |
| ----------- | ------ | ----------- |
| project\_id | string | Project ID  |

#### Headers

| Name          | Type   | Description    |
| ------------- | ------ | -------------- |
| Authorization | string | Bearer {token} |

{% tabs %}
{% tab title="200 Successfull Response." %}

```
{
    "additional_data": null,
    "data": [
        {
            "_id": "5fb3a2732943b4000b79040f",
            "account_id": "5db04e9e2943b4255fe71d0a",
            "cache": 1,
            "cr_hostname": "https://p21web.controltekusa.com:3443",
            "cr_name": "Test",
            "cr_timezone": "Asia/Kolkata",
            "created_at": "Tue, 17 Nov 2020 10:14:11 GMT",
            "created_by": "5db04e9e2943b4255fe71d0a",
            "cron_exp": "*/30 * * * *",
            "datapoint": "Epicor P21 Core",
            "email": "surekas@dckap.com",
            "health_check_enabled": false,
            "isDeleted": false,
            "project_id": "5fb39ec92943b4000b7903d8",
            "system": "5de0f57d2943b46529ab162d",
            "updated_at": "Tue, 17 Nov 2020 10:14:23 GMT",
            "updated_by": "5db04e9e2943b4255fe71d0a"
        }
    ],
    "error_code": "",
    "message": "Credentials listed successfully",
    "next": 0,
    "page": 1,
    "pages": [],
    "prev": 0,
    "status": 200,
    "success": true,
    "total": 1,
    "total_records": 1
}
```

{% endtab %}

{% tab title="404 Authentication Error." %}

```
{
    "data": null,
    "message": "UserWarning('Suspicious login attempt',)",
    "response_status": 401,
    "status": false,
    "status_code": 401
}
```

{% endtab %}
{% endtabs %}

## Test Connection

<mark style="color:blue;">`GET`</mark> `https://integrator.dckap.com/workspace/:project_id/api/credentials/test/:credential_id/:cache`

Tests the connection for given crendential.

#### Path Parameters

| Name           | Type   | Description                                                        |
| -------------- | ------ | ------------------------------------------------------------------ |
| project\_id    | string | Project ID                                                         |
| credential\_id | string | Credentials ID                                                     |
| cache          | string | 1 for reusing old token and 0 for fresh token. Default value is 1. |

#### Headers

| Name          | Type   | Description            |
| ------------- | ------ | ---------------------- |
| Authorization | string | Bearer {access\_token} |

{% tabs %}
{% tab title="200 Successfull Response" %}

```
{
    "reason": "Errors If Any",
    "status": True or False
}
```

{% endtab %}

{% tab title="401 Authentication Error" %}

```
{
    "data": null,
    "message": "UserWarning('Suspicious login attempt',)",
    "response_status": 401,
    "status": false,
    "status_code": 401
}
```

{% endtab %}
{% endtabs %}
