# Network › OVHcloud Connect › Diagnostics API

> Part of the OVHcloud developer hub. Index of every page and section: https://developers.eu.ovhcloud.com/llms.txt
> The Network product's sections: https://developers.eu.ovhcloud.com/reference/network/llms.txt
> Everything in one file: https://developers.eu.ovhcloud.com/llms-full.txt

> 3 operations of the OVHcloud API. Calls carry `authorization: Bearer $OVH_TOKEN`; the EU host is shown, Canada and the United States answer on api.ca.ovhcloud.com and api.us.ovhcloud.com.

Page: https://developers.eu.ovhcloud.com/reference/network/ovhcloud-connect/diagnostics/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/network/ovhcloud-connect/diagnostics.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/network/ovhcloud-connect/diagnostics.json?format=openapi3

## Operations

- `GET /ovhCloudConnect/{serviceName}/diagnostic` — List diagnostics
- `GET /ovhCloudConnect/{serviceName}/diagnostic/{id}` — Get diagnostic
- `POST /ovhCloudConnect/{serviceName}/diagnostic` — Run diagnostic

## List diagnostics

`GET /1.0/ovhCloudConnect/{serviceName}/diagnostic`

Link: https://developers.eu.ovhcloud.com/reference/network/ovhcloud-connect/diagnostics/#get-ovhcloudconnect-servicename-diagnostic

**Status:** Stable production version  
**IAM actions:** `ovhCloudConnect:apiovh:diagnostic/get`

Returns the IDs of the diagnostics run on the service.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string (uuid) | yes | Service name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | integer[] | successful operation |

```json
[
  0
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/ovhCloudConnect/{serviceName}/diagnostic" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/ovhCloudConnect/{serviceName}/diagnostic")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/ovhCloudConnect/{serviceName}/diagnostic");

print_r($result);
?>
```

## Get diagnostic

`GET /1.0/ovhCloudConnect/{serviceName}/diagnostic/{id}`

Link: https://developers.eu.ovhcloud.com/reference/network/ovhcloud-connect/diagnostics/#get-ovhcloudconnect-servicename-diagnostic-id

**Status:** Stable production version  
**IAM actions:** `ovhCloudConnect:apiovh:diagnostic/get`

Returns the diagnostic status and the equipment output (BGP state, routes or MACs).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id |
| `serviceName` | path | string (uuid) | yes | Service name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | ovhcloudconnect.Diagnostic | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `date` | string (date-time) | read-only | Date of the diagnostic |
| `description` | string | read-only | Description of the diagnostic |
| `function` | ovhcloudconnect.diagnostic.FunctionEnum | read-only | Diagnostic function — one of `diagAccessEdge`, `diagMacs`, `diagPeering`, `diagPeeringExtra`, `diagRoutes` |
| `id` | integer | read-only | Diagnostic id |
| `result` | ovhcloudconnect.DiagnosticResult[] | read-only | Diagnostic result |
| `result[].aspath` | string | read-only | As-path for routes |
| `result[].cmd` | string | read-only | Command sent to equipment |
| `result[].localprefix` | integer | read-only | Local prefix used for routes |
| `result[].mac` | macAddress | read-only | Mac address |
| `result[].med` | integer | read-only | BGP Med (Metric) |
| `result[].output` | string | read-only | Output of command sent to equipment |
| `result[].prefix` | ipBlock | read-only | Prefix for routes |
| `result[].routermac` | string | read-only | eVPN router mac |
| `result[].timestamp` | string (date-time) | read-only | Local date when route/mac was declared |
| `source` | string | read-only | Source where the diagnostic was run |
| `status` | ovhcloudconnect.task.StatusEnum | read-only | Diagnostic status — one of `denied`, `doing`, `done`, `error`, `pause`, `todo` |

```json
{
  "date": "2024-01-01T12:00:00Z",
  "description": "string",
  "function": "diagAccessEdge",
  "id": 0,
  "result": [
    {
      "aspath": "string",
      "cmd": "string",
      "localprefix": 0,
      "mac": "00:00:5e:00:53:01",
      "med": 0,
      "output": "string",
      "prefix": "192.0.2.0/24",
      "routermac": "string",
      "timestamp": "2024-01-01T12:00:00Z"
    }
  ],
  "source": "string",
  "status": "denied"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/ovhCloudConnect/{serviceName}/diagnostic/{id}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/ovhCloudConnect/{serviceName}/diagnostic/{id}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/ovhCloudConnect/{serviceName}/diagnostic/{id}");

print_r($result);
?>
```

## Run diagnostic

`POST /1.0/ovhCloudConnect/{serviceName}/diagnostic`

Link: https://developers.eu.ovhcloud.com/reference/network/ovhcloud-connect/diagnostics/#post-ovhcloudconnect-servicename-diagnostic

**Status:** Stable production version  
**IAM actions:** `ovhCloudConnect:apiovh:diagnostic/create`

Checks BGP peering, routes or MAC addresses on a configuration; runs per 24 h are capped.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string (uuid) | yes | Service name |

### Request body (required)

Type: `ovhcloudconnect.DiagnosticConfiguration`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `dcConfigId` | integer |  | ID of the Datacenter configuration |
| `diagnosticName` | ovhcloudconnect.diagnostic.FunctionEnum | yes | Name of the diagnostic — one of `diagAccessEdge`, `diagMacs`, `diagPeering`, `diagPeeringExtra`, `diagRoutes` |
| `diagnosticType` | ovhcloudconnect.diagnostic.TypeEnum |  | Type of the diagnostic — one of `advertised-routes`, `default`, `routes` |
| `edgeId` | integer |  | ID of the service Edge |
| `extraConfigId` | integer |  | ID of the extra configuration |
| `popConfigId` | integer |  | ID of the Pop Configuration |

```json
{
  "dcConfigId": 0,
  "diagnosticName": "diagAccessEdge",
  "diagnosticType": "advertised-routes",
  "edgeId": 0,
  "extraConfigId": 0,
  "popConfigId": 0
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | ovhcloudconnect.Diagnostic | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `date` | string (date-time) | read-only | Date of the diagnostic |
| `description` | string | read-only | Description of the diagnostic |
| `function` | ovhcloudconnect.diagnostic.FunctionEnum | read-only | Diagnostic function — one of `diagAccessEdge`, `diagMacs`, `diagPeering`, `diagPeeringExtra`, `diagRoutes` |
| `id` | integer | read-only | Diagnostic id |
| `result` | ovhcloudconnect.DiagnosticResult[] | read-only | Diagnostic result |
| `result[].aspath` | string | read-only | As-path for routes |
| `result[].cmd` | string | read-only | Command sent to equipment |
| `result[].localprefix` | integer | read-only | Local prefix used for routes |
| `result[].mac` | macAddress | read-only | Mac address |
| `result[].med` | integer | read-only | BGP Med (Metric) |
| `result[].output` | string | read-only | Output of command sent to equipment |
| `result[].prefix` | ipBlock | read-only | Prefix for routes |
| `result[].routermac` | string | read-only | eVPN router mac |
| `result[].timestamp` | string (date-time) | read-only | Local date when route/mac was declared |
| `source` | string | read-only | Source where the diagnostic was run |
| `status` | ovhcloudconnect.task.StatusEnum | read-only | Diagnostic status — one of `denied`, `doing`, `done`, `error`, `pause`, `todo` |

```json
{
  "date": "2024-01-01T12:00:00Z",
  "description": "string",
  "function": "diagAccessEdge",
  "id": 0,
  "result": [
    {
      "aspath": "string",
      "cmd": "string",
      "localprefix": 0,
      "mac": "00:00:5e:00:53:01",
      "med": 0,
      "output": "string",
      "prefix": "192.0.2.0/24",
      "routermac": "string",
      "timestamp": "2024-01-01T12:00:00Z"
    }
  ],
  "source": "string",
  "status": "denied"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/ovhCloudConnect/{serviceName}/diagnostic" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: ovhcloudconnect.DiagnosticConfiguration
result = client.post("/ovhCloudConnect/{serviceName}/diagnostic",
	dcConfigId = None, # ID of the Datacenter configuration (type: integer)
	diagnosticName = None, # Name of the diagnostic (type: ovhcloudconnect.diagnostic.FunctionEnum)
	diagnosticType = None, # Type of the diagnostic (type: ovhcloudconnect.diagnostic.TypeEnum)
	edgeId = None, # ID of the service Edge (type: integer)
	extraConfigId = None, # ID of the extra configuration (type: integer)
	popConfigId = None, # ID of the Pop Configuration (type: integer)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: ovhcloudconnect.DiagnosticConfiguration
$result = $ovh->post("/ovhCloudConnect/{serviceName}/diagnostic", array(
	dcConfigId => null, // ID of the Datacenter configuration (type: integer)
	diagnosticName => null, // Name of the diagnostic (type: ovhcloudconnect.diagnostic.FunctionEnum)
	diagnosticType => null, // Type of the diagnostic (type: ovhcloudconnect.diagnostic.TypeEnum)
	edgeId => null, // ID of the service Edge (type: integer)
	extraConfigId => null, // ID of the extra configuration (type: integer)
	popConfigId => null, // ID of the Pop Configuration (type: integer)
));

print_r($result);
?>
```
