# Web Cloud › Web Hosting › Operations 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

> 2 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/web-hosting/operations/

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

## Operations

- `GET /hosting/web/{serviceName}/tasks` — List tasks
- `GET /hosting/web/{serviceName}/tasks/{id}` — Get a task

## List tasks

`GET /1.0/hosting/web/{serviceName}/tasks`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/web-hosting/operations/#get-hosting-web-servicename-tasks

**Status:** Stable production version  
**IAM actions:** `webHosting:apiovh:tasks/get`

Returns the IDs of the tasks of the hosting. Filter them by function or status.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `function` | query | string |  | Filter tasks by function (like) |
| `serviceName` | path | string | yes | Service name |
| `status` | query | hosting.web.task.StatusEnum |  | Filter tasks by status (like) — one of `cancelled`, `doing`, `done`, `init`, `todo` |

### Responses

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

```json
[
  0
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/hosting/web/{serviceName}/tasks" \
  -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("/hosting/web/{serviceName}/tasks")

# 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("/hosting/web/{serviceName}/tasks");

print_r($result);
?>
```

## Get a task

`GET /1.0/hosting/web/{serviceName}/tasks/{id}`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/web-hosting/operations/#get-hosting-web-servicename-tasks-id

**Status:** Stable production version  
**IAM actions:** `webHosting:apiovh:tasks/get`

Returns the function, status and dates of the task.

### Parameters

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

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | hosting.web.PublicTask | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `doneDate` | string (date-time) | read-only | Done date |
| `function` | hosting.web.task.FunctionEnum | read-only | Task function — one of `abuse/close`, `abuse/create`, `abuse/create/web`, `abuse/delete/web`, `abuse/update`, `abuse/update/web`, `agora/AnycastUpdateReference`, `agora/DnsAddonUpdateReference`, `agora/DnsUpdateReference`, `agora/updateReference`, `attachedDomain/create`, `attachedDomain/delete`, … |
| `id` | integer | read-only | Task's id |
| `lastUpdate` | string (date-time) | read-only | Last update date |
| `objectId` | string | read-only | Task object id |
| `objectType` | hosting.web.task.ObjectTypeEnum | read-only | Task object type — one of `Abuse`, `AttachedDomain`, `BlockedIp`, `Cdn`, `Cron`, `Database`, `Deployment`, `Dump`, `EnvVar`, `Filerz`, `Hostedssl`, `Hosting`, … |
| `startDate` | string (date-time) | read-only | Start date |
| `status` | hosting.web.task.StatusEnum | read-only | Task status — one of `cancelled`, `doing`, `done`, `init`, `todo` |

```json
{
  "doneDate": "2024-01-01T12:00:00Z",
  "function": "abuse/close",
  "id": 0,
  "lastUpdate": "2024-01-01T12:00:00Z",
  "objectId": "string",
  "objectType": "Abuse",
  "startDate": "2024-01-01T12:00:00Z",
  "status": "cancelled"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/hosting/web/{serviceName}/tasks/{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("/hosting/web/{serviceName}/tasks/{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("/hosting/web/{serviceName}/tasks/{id}");

print_r($result);
?>
```
