## Overview

This endpoint is used to trigger the execution of a single existing **Scheduled Task**. To consume it, you must be an  [Authenticated User](https://developer.sellercloud.com/dev-article/authentication/). Once you have obtained a valid token, it must be passed on the call.

## Endpoint

An example of this endpoint for server **XX** is:

​​https:// **xx**.api.sellercloud.com/rest/api/ScheduledTasks/{id}/ExecuteTask​

For your server, the endpoint will be:

https:// **{your_server_id}**.api.sellercloud.com/rest/api/ScheduledTasks/{id}/ExecuteTask

## Request

- Method Type: **HttpPost**
- Authorization: Use **Bearer Token** + token received from token authentication
- Header info: **Content-Type: application/json**
- Parameters: ID of the existing Schedule Task

|     |     |     |     |
| --- | --- | --- | --- |
| **Parameter** | **Data Type** | **Description** | **Is Required** |
| id | integer | The ID of an existing **Scheduled Task.** | Yes |

## Response

- If the user is authenticated and provides a valid Scheduled Task ID, then the response will be **Status Code 200 => OK**, with the ID of the new Queued Job that was created and a link to the queued job in JSON format.
- If the user is not authenticated, then the response will be **Status Code 401 => Not Valid Token.**
- In case of an error, the response will be **Status Code 500 => Internal Server Error.**

## Example Response

```json
{
  "QueuedJobLink": "string",
  "ID": 0,
  "Message": "string"
}
```

## Demo in C#

```csharp
static async Task Main(string[] args)
{
    await GetExecutionHistory();
}
static async Task GetExecutionHistory()
{
    // Valid ID of a scheduled task can be found through Delta UI
    int taskID = 28142;

// URL for downloading execution history
    string url = $"http://tt.cwa.sellercloud.com/rest/api/ScheduledTasks/{taskID}/ExecuteTask";

// Valid token must be provided here
    string token = "test token";

using (HttpClient client = new HttpClient())
    {
        client.DefaultRequestHeaders.Authorization =
            new AuthenticationHeaderValue("Bearer", token);
        HttpResponseMessage responseMessage = await client.GetAsync(url);

var content = responseMessage.Content;
    }
}
```

```csharp
public class QueuedJobResponse
{
    public string QueuedJobLink { get; set; }
    public int ID { get; set; }
}
```
