# Public Cloud › Databases › MongoDB › Configuration API

> Part of the OVHcloud developer hub. Index of every page and section: https://developers.eu.ovhcloud.com/llms.txt
> The Public Cloud product's sections: https://developers.eu.ovhcloud.com/reference/public-cloud/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/public-cloud/databases/mongodb/configuration/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/public-cloud/databases/mongodb/configuration.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/public-cloud/databases/mongodb/configuration.json?format=openapi3

## Operations

- `GET /publicCloud/project/{projectId}/managedDatabase/mongodb/{serviceId}/maintenance` — List maintenances
- `GET /publicCloud/project/{projectId}/managedDatabase/mongodb/{serviceId}/maintenance/{maintenanceId}` — Get a maintenance
- `POST /publicCloud/project/{projectId}/managedDatabase/mongodb/{serviceId}/maintenance` — Apply a maintenance

## List maintenances

`GET /v2/publicCloud/project/{projectId}/managedDatabase/mongodb/{serviceId}/maintenance`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/databases/mongodb/configuration/#get-publiccloud-project-projectid-manageddatabase-mongodb-serviceid-maintenance

**Status:** Beta version  
**IAM actions:** `publicCloudProject:apiovh:database/mongodb/maintenance/get`

Returns the maintenances of the service, with their schedule and status.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Pagination-Cursor` | header | string |  | Pagination cursor |
| `X-Pagination-Size` | header | integer |  | Pagination size |
| `projectId` | path | string | yes | Project ID |
| `serviceId` | path | string (uuid) | yes | Service ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.database.MaintenanceWindow[] | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `appliedAt` | string (date-time) | read-only | Date and time at which the maintenance was applied. Null when not yet applied. |
| `checksum` | string | read-only | Hash of the resource used for concurrency control |
| `description` | string | read-only | Human-readable description of the maintenance operations to be performed |
| `id` | string (uuid) | read-only | Unique identifier of the maintenance window |
| `scheduledAt` | string (date-time) | read-only | Date and time at which the maintenance window is scheduled to start |
| `status` | publicCloud.database.MaintenanceStatusEnum | read-only | Current status of the maintenance window — one of `APPLIED`, `APPLYING`, `ERROR`, `SCHEDULED` |

```json
[
  {
    "appliedAt": "2024-01-01T12:00:00Z",
    "checksum": "string",
    "description": "string",
    "id": "00000000-0000-0000-0000-000000000000",
    "scheduledAt": "2024-01-01T12:00:00Z",
    "status": "APPLIED"
  }
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedDatabase/mongodb/{serviceId}/maintenance" \
  -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("/v2/publicCloud/project/{projectId}/managedDatabase/mongodb/{serviceId}/maintenance")

# 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("/v2/publicCloud/project/{projectId}/managedDatabase/mongodb/{serviceId}/maintenance");

print_r($result);
?>
```

## Get a maintenance

`GET /v2/publicCloud/project/{projectId}/managedDatabase/mongodb/{serviceId}/maintenance/{maintenanceId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/databases/mongodb/configuration/#get-publiccloud-project-projectid-manageddatabase-mongodb-serviceid-maintenance-maintenanceid

**Status:** Beta version  
**IAM actions:** `publicCloudProject:apiovh:database/mongodb/maintenance/get`

Returns the operations planned by a maintenance, its schedule and its status.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `maintenanceId` | path | string (uuid) | yes | Maintenance ID |
| `projectId` | path | string | yes | Project ID |
| `serviceId` | path | string (uuid) | yes | Service ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.database.MaintenanceWindow | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `appliedAt` | string (date-time) | read-only | Date and time at which the maintenance was applied. Null when not yet applied. |
| `checksum` | string | read-only | Hash of the resource used for concurrency control |
| `description` | string | read-only | Human-readable description of the maintenance operations to be performed |
| `id` | string (uuid) | read-only | Unique identifier of the maintenance window |
| `scheduledAt` | string (date-time) | read-only | Date and time at which the maintenance window is scheduled to start |
| `status` | publicCloud.database.MaintenanceStatusEnum | read-only | Current status of the maintenance window — one of `APPLIED`, `APPLYING`, `ERROR`, `SCHEDULED` |

```json
{
  "appliedAt": "2024-01-01T12:00:00Z",
  "checksum": "string",
  "description": "string",
  "id": "00000000-0000-0000-0000-000000000000",
  "scheduledAt": "2024-01-01T12:00:00Z",
  "status": "APPLIED"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedDatabase/mongodb/{serviceId}/maintenance/{maintenanceId}" \
  -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("/v2/publicCloud/project/{projectId}/managedDatabase/mongodb/{serviceId}/maintenance/{maintenanceId}")

# 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("/v2/publicCloud/project/{projectId}/managedDatabase/mongodb/{serviceId}/maintenance/{maintenanceId}");

print_r($result);
?>
```

## Apply a maintenance

`POST /v2/publicCloud/project/{projectId}/managedDatabase/mongodb/{serviceId}/maintenance`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/databases/mongodb/configuration/#post-publiccloud-project-projectid-manageddatabase-mongodb-serviceid-maintenance

**Status:** Beta version  
**IAM actions:** `publicCloudProject:apiovh:database/mongodb/maintenance/apply`

Applies a scheduled maintenance immediately, instead of waiting for its scheduled time.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | string | yes | Project ID |
| `serviceId` | path | string (uuid) | yes | Service ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.database.MaintenanceWindow | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `appliedAt` | string (date-time) | read-only | Date and time at which the maintenance was applied. Null when not yet applied. |
| `checksum` | string | read-only | Hash of the resource used for concurrency control |
| `description` | string | read-only | Human-readable description of the maintenance operations to be performed |
| `id` | string (uuid) | read-only | Unique identifier of the maintenance window |
| `scheduledAt` | string (date-time) | read-only | Date and time at which the maintenance window is scheduled to start |
| `status` | publicCloud.database.MaintenanceStatusEnum | read-only | Current status of the maintenance window — one of `APPLIED`, `APPLYING`, `ERROR`, `SCHEDULED` |

```json
{
  "appliedAt": "2024-01-01T12:00:00Z",
  "checksum": "string",
  "description": "string",
  "id": "00000000-0000-0000-0000-000000000000",
  "scheduledAt": "2024-01-01T12:00:00Z",
  "status": "APPLIED"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedDatabase/mongodb/{serviceId}/maintenance" \
  -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.post("/v2/publicCloud/project/{projectId}/managedDatabase/mongodb/{serviceId}/maintenance")

# 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->post("/v2/publicCloud/project/{projectId}/managedDatabase/mongodb/{serviceId}/maintenance");

print_r($result);
?>
```
