Download Template For Basic Import

Updated 1 week ago ​by nussi

Overview

In order to retrieve download template, you must:

  • Be authenticated user

For information on how you can authenticate, see: Authentication

  • Provide what type of template you want: For variations, kits, shadows etc.
  • Provide what type of file do you want: Tab Delimited, CSV, Excel

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

Endpoint

Example for such endpoint for TT server is https://tt.api.sellercloud.com/rest/api/Catalog/Imports/BasicImports/{typeOfImport}/Template?fileFormat = {file_Format}

Example endpoint URL could be:

https://tt.api.sellercloud.com/rest/api/Catalog/Imports/BasicImports/4/Template?fileFormat = 2

This will download Excel file that will be used for importing kits information.

Request

  • Method Type: HttpGet
  • Authorization: Use Bearer Token + token received from token authentication
  • Header info: Content-Type: application/json

Different file format types are:

{
TAB_Delimited = 0
CSV = 1
Excel = 2
}

Type of imports are:

public enum CatalogImportKind
{
[Description("Bulk Product Update")]
BulkUpdateProducts = 0,

[Description("Import Info via Plugin/Profile")]
ViaPluginProfile = 1,

[Description("Import Shadows")]
Shadows = 2,

[Description("Import Variations")]
Variations = 3,

[Description("Import Kits")]
Kits = 4,

[Description("Import Kit Box Dimensions")]
KitBoxDimensions = 5,

[Description("Import Ebay Specifics")]
EbaySpecifics = 6,

[Description("Import Product Images")]
ProductImages = 7,

[Description("Import Product Channel Specific Images")]
ProductChannelSpecificImages = 8,

[Description("Import Walmart Marketplace Attributes")]
WalmartMarketplaceAttributes = 9,

[Description("Import Walmart Marketplace Variation Values")]
WalmartMarketplaceVariationValues = 10,

[Description("Import Newegg.com Attributes")]
NeweggComAttributes = 11,

[Description("Import Amazon Attributes")]
AmazonAttributes = 12,

[Description("Import Amazon Hazardous Attributes")]
AmazonHazardousAttributes = 13,

[Description("Import Product Clones")]
ProductClones = 14,

[Description("Import Variations Images")]
VariationImages = 15,

[Description("Import Product Groups")]
ProductGroups = 16,

[Description("Import Product Average Cost Adjustments")]
ProductAverageCostAdjustments = 17,

[Description("Import Product Rebates")]
ProductRebates = 18,

[Description("Import Product Replacements")]
ProductReplacements = 19,

[Description("Import Newegg Biz Attributes")]
NeweggBizAttributes = 20,

[Description("Import Product Titles")]
ProductTitles = 21,

[Description("Import Sears Attributes")]
SearsAttributes = 22,

[Description("Import Jet Attributes")]
JetAttributes = 23,

[Description("Import Magento Attributes")]
MagentoAttributes = 24,

[Description("Import Ebay Parts Compatibility")]
EbayPartsCompatibility = 25,

[Description("Import Related Products")]
RelatedProducts = 26,

[Description("Import Shopify Metafields")]
ShopifyMetafields = 27,

[Description("Import Product Documents")]
ProductDocuments = 28,

[Description("Import Bonanza Traits")]
BonanzaTraits = 29,

[Description("Import Product Notes")]
ProductNotes = 30,

[Description("Import Ebay Auctions")]
EbayAuctions = 31,

[Description("Import SKU Splitting Info")]
SkuSplittingInfo = 32,

[Description("Import Per-Channel UPC")]
PerChannelUpc = 33,

[Description("Import Magento Tier Pricing")]
MagentoTierPricing = 34,

[Description("Import Newegg.Com International Prices")]
NeweggComInternationalPrices = 35,

[Description("Import Product Alias")]
ProductAliases = 36,

[Description("Import Product Accessories")]
ProductAccessories = 37,

[Description("Import Rakuten Attributes")]
RakutenAttributes = 38,
}

Response

  • If user is authenticated and file successfully downloaded then response will be Status Code 200 => OK and content will be byte of arrays encoded to base-64.
    Client needs to decode them and use then bytes of array to store the file. In the response content header there is a ContentDisposition item that brings information about the name of the file.

  • If user is not authenticated, then response will be Status Code 401 => Not Valid Token
  • On server response => Status Code 500 => Internal Server Error
    It is possible client to want to download template in format that is currently not supported. In such case response will be Status Code 400 with error message.

Example code in c#

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


static async Task DownloadTemplate()
{

string url = $"http://cwa.api.sellercloud.com//api/Catalog/Imports/BasicImports/5/Template?fileFormat=2";

// 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:\\Data\\TestRuns\\{responseMessage.Content.Headers.ContentDisposition.FileName}", contentInBytes);
}
}


How did we do?