Product Export via Mapping Profile - Sellercloud API Docs

Product Export via Mapping Profile

Table of Contents

Overview

In order to do product export via mapping profile, you must:

For information on how you can authenticate, see: Authentication

As soon as you do authentication and receive a valid token, it needs to be passed on the call to the server.

Mapping Profiles

Getting available mapping profiles can be done from here:

https://tt.api.sellercloud.com/rest/api/Catalog/Exports/ViaMappingProfile/Metadata

Current example is for TT server. For your server it will be:

https://{server_id}.api.sellercloud.com/rest/api/Catalog/Exports/ViaMappingProfile/Metadata

Mapping profile will be used for doing products export.

Endpoint for exporting via Mapping Profile

Example for such endpoint for TT server is https://tt.api.sellercloud.com/rest/api/Catalog/ViaMappingProfile

For your server:

https://{server_id}.api.sellercloud.com/rest/api/Catalog/ViaMappingProfile

Request

Request Model

Field Name Type Description
PluginProfileKey string Mapping profile key received from above endpoint.
FileFormat string File format type of exported data.
<br>TAB_Delimited = 0<br>CSV = 1<br>Excel = 2<br>
ProductIds Array of strings List of product SKUs.

Response

Demo in c#

private static string token = "test token";

static async Task GetFirstMappingProfile()  
{
    string url = $"http://cwa.api.sellercloud.com/api/Catalog/Exports/ViaMappingProfile/Metadata";

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 profiles = JsonConvert.DeserializeObject(content);
        return profiles.MappingProfiles
                               .First()
                               .Key;
    }
}

static async Task Export(string profile)  
{
    string url = $"http://cwa.api.sellercloud.com/api/Catalog/Exports/ViaMappingProfile";
    var content = new ExportRequest()  
    {
        ProductIds = new string[] { "test" },
        PluginProfileKey = profile,
        FileFormat = FileFormat.Excel
    };

using (var client = new HttpClient())  
    using (var request = new HttpRequestMessage(HttpMethod.Post, url))  
    {
        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

var json = JsonConvert.SerializeObject(content);
        using (var stringContent = new StringContent(json, Encoding.UTF8, "application/json"))  
        {
            request.Content = stringContent;

HttpResponseMessage responseMessage = await client.SendAsync(request);
            var jobLink = await responseMessage.Content.ReadAsStringAsync();
        }
    }
}

static async Task Main(string[] args)  
{
    var profile = await GetFirstMappingProfile();

var jobLink = await Export(profile);
}