# Web Cloud › Video Center API

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

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/web-cloud/video-center.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/web-cloud/video-center.json?format=openapi3

## Operations

- `GET /videocenter/resource` — Get all services
- `GET /videocenter/resource/{serviceId}` — Get a service
- `POST /videocenter/resource/{serviceId}/auth/token` — Generate an Auth Token

## Get all services

`GET /v2/videocenter/resource`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/video-center/#get-videocenter-resource

**Status:** Alpha version  
**IAM actions:** `videocenter:apiovh:service/get`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Pagination-Cursor` | header | string |  | Pagination cursor |
| `X-Pagination-Size` | header | integer |  | Pagination size |
| `iamTags` | query | object |  | Filter resources on IAM tags |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | videocenter.ServiceWithIAM[] | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `currentState` | videocenter.ServiceCurrentState | read-only | What the service currently holds and how much of its offer is used |
| `currentState.createdAt` | string (date-time) | read-only | Creation date of the service |
| `currentState.offerName` | string | read-only | Commercial offer the service runs on, which sets the video count and duration it is allowed |
| `currentState.vodCount` | videocenter.ServiceCurrentStateVodCount | read-only | Video count |
| `currentState.vodCount.allocated` | integer | read-only | The total number of hosted videos (actual usage) |
| `currentState.vodCount.hostable` | integer | read-only | The total number of hostable videos (maximum capacity) |
| `currentState.vodDurationMinutes` | videocenter.ServiceCurrentStateVodDurationMinutes | read-only | Video duration minutes |
| `currentState.vodDurationMinutes.allocated` | number | read-only | The total used duration of video (actual usage) |
| `currentState.vodDurationMinutes.hostable` | integer | read-only | The total number of hostable minutes of videos (maximum capacity) |
| `iam` | iam.ResourceMetadata | read-only | IAM resource metadata |
| `iam.displayName` | string | read-only | Resource display name |
| `iam.id` | string (uuid) | read-only | Unique identifier of the resource |
| `iam.state` | iam.ResourceMetadata.StateEnum | read-only | Resource state — one of `EXPIRED`, `IN_CREATION`, `OK`, `SUSPENDED` |
| `iam.tags` | object | read-only | Resource tags. Tags that were internally computed are prefixed with ovh: |
| `iam.urn` | string | read-only | Unique resource name used in policies |
| `id` | string (uuid) | read-only | Unique identifier of the service |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Whether the service is ready to use, still being set up, or in error — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |

```json
[
  {
    "currentState": {
      "createdAt": "2024-01-01T12:00:00Z",
      "offerName": "string",
      "vodCount": {
        "allocated": 0,
        "hostable": 0
      },
      "vodDurationMinutes": {
        "allocated": 0,
        "hostable": 0
      }
    },
    "iam": {
      "displayName": "string",
      "id": "00000000-0000-0000-0000-000000000000",
      "state": "EXPIRED",
      "tags": {
        "key": "string"
      },
      "urn": "string"
    },
    "id": "00000000-0000-0000-0000-000000000000",
    "resourceStatus": "CREATING"
  }
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/videocenter/resource" \
  -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/videocenter/resource")

# 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/videocenter/resource");

print_r($result);
?>
```

## Get a service

`GET /v2/videocenter/resource/{serviceId}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/video-center/#get-videocenter-resource-serviceid

**Status:** Alpha version  
**IAM actions:** `videocenter:apiovh:service/get`

### Parameters

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

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | videocenter.ServiceWithIAM | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `currentState` | videocenter.ServiceCurrentState | read-only | What the service currently holds and how much of its offer is used |
| `currentState.createdAt` | string (date-time) | read-only | Creation date of the service |
| `currentState.offerName` | string | read-only | Commercial offer the service runs on, which sets the video count and duration it is allowed |
| `currentState.vodCount` | videocenter.ServiceCurrentStateVodCount | read-only | Video count |
| `currentState.vodCount.allocated` | integer | read-only | The total number of hosted videos (actual usage) |
| `currentState.vodCount.hostable` | integer | read-only | The total number of hostable videos (maximum capacity) |
| `currentState.vodDurationMinutes` | videocenter.ServiceCurrentStateVodDurationMinutes | read-only | Video duration minutes |
| `currentState.vodDurationMinutes.allocated` | number | read-only | The total used duration of video (actual usage) |
| `currentState.vodDurationMinutes.hostable` | integer | read-only | The total number of hostable minutes of videos (maximum capacity) |
| `iam` | iam.ResourceMetadata | read-only | IAM resource metadata |
| `iam.displayName` | string | read-only | Resource display name |
| `iam.id` | string (uuid) | read-only | Unique identifier of the resource |
| `iam.state` | iam.ResourceMetadata.StateEnum | read-only | Resource state — one of `EXPIRED`, `IN_CREATION`, `OK`, `SUSPENDED` |
| `iam.tags` | object | read-only | Resource tags. Tags that were internally computed are prefixed with ovh: |
| `iam.urn` | string | read-only | Unique resource name used in policies |
| `id` | string (uuid) | read-only | Unique identifier of the service |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Whether the service is ready to use, still being set up, or in error — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |

```json
{
  "currentState": {
    "createdAt": "2024-01-01T12:00:00Z",
    "offerName": "string",
    "vodCount": {
      "allocated": 0,
      "hostable": 0
    },
    "vodDurationMinutes": {
      "allocated": 0,
      "hostable": 0
    }
  },
  "iam": {
    "displayName": "string",
    "id": "00000000-0000-0000-0000-000000000000",
    "state": "EXPIRED",
    "tags": {
      "key": "string"
    },
    "urn": "string"
  },
  "id": "00000000-0000-0000-0000-000000000000",
  "resourceStatus": "CREATING"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/videocenter/resource/{serviceId}" \
  -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/videocenter/resource/{serviceId}")

# 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/videocenter/resource/{serviceId}");

print_r($result);
?>
```

## Generate an Auth Token

`POST /v2/videocenter/resource/{serviceId}/auth/token`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/video-center/#post-videocenter-resource-serviceid-auth-token

**Status:** Alpha version  
**IAM actions:** `videocenter:apiovh:service/auth/token`

### Parameters

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

### Request body (required)

Type: `videocenter.AuthTokenRequest`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `language` | string | yes | Language the player interface and its messages should be shown in |

```json
{
  "language": "string"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | videocenter.AuthTokenResponse | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `token` | string | read-only | JWT |

```json
{
  "token": "string"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/v2/videocenter/resource/{serviceId}/auth/token" \
  -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: videocenter.AuthTokenRequest
result = client.post("/v2/videocenter/resource/{serviceId}/auth/token",
	language = None, # Language the player interface and its messages should be shown in (type: string)
)

# 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: videocenter.AuthTokenRequest
$result = $ovh->post("/v2/videocenter/resource/{serviceId}/auth/token", array(
	language => null, // Language the player interface and its messages should be shown in (type: string)
));

print_r($result);
?>
```
