Execute Scheduled Task

Overview

In order to execute a scheduled task, you can consume the endpoint presented in this article. In order to consume it, you must:

  1. Be authenticated user. For information on how you can authenticate, see: Authentication
  2. You must also know the ID of the scheduled task that you’d like to execute. This can be seen from Manage Scheduled Tasks page in the Delta UI.

Endpoint

Example for such endpoint for TT server is:

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

For your server 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 ID of existing task Yes

Example:

​​https://tt.api.sellercloud.com/rest/api/ScheduledTasks/1/ExecuteTask

Response

  • If user is authenticated and provides a valid ID of a scheduled task, then response will be Status Code 200 => OK, with the ID of the queued job that was created and a link to the queued job in JSON format
  • If user is not authenticated, then response will be Status Code 401 => Not Valid Token
  • On server response => Status Code 500 => Internal Server Error

Example Response

Demo in C#

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;
}
}

public int ID { get; set; }
}

Was this article helpful?

Related Articles