Get Queued Job Output File - Sellercloud API Docs

Table of Contents

Overview

With this endpoint, you can retrieve the Output File of a single existing Queued Job. To consume it, you must be an Authenticated User. Once you have obtained a valid token, you must pass it to the call. Additionally, you need a valid ID of an existing queued job.

Endpoint

An example of this endpoint for server XX:

https:// xx.api.sellercloud.com/rest/api/QueuedJobs/OutputFile/{id}

For your server, the endpoint will be:

​https:// {your_server_id}.api.sellercloud.com/rest/api/QueuedJobs/OutputFile/{id}

Request

Parameter Data Type Description Is Required
id integer The ID of the existing queued job. Yes

Response

Demo in c#

static async Task Main(string[] args)
{
    await GetOutputFile();

Console.WriteLine("Output file successfully downloaded!");
}

static async Task GetOutputFile()
{
   // Valid ID of a queued job must be provided here
   int jobID = 28142;

// URL for downloading output file of a queued job
   string url = $"http://localhost:64158/api/QueuedJobs/OutputFile?id={jobID}";

// 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
                                             .ReadAsStringAsync()
                                             .Result;

var contentInBytes = Convert.FromBase64String(content);

System.IO.File.WriteAllBytes($@"C:DataTestRuns{responseMessage.Content.Headers.ContentDisposition.FileName}", contentInBytes);
    }
}