Import Catalog Info - Sellercloud API Docs
Import Catalog Info
Overview
This endpoint is for importing catalog-related data into Sellercloud via the Rest API. Our REST API provides a host of options that are designed to simplify your data import process.
Our REST API allows you to do many of the same kinds of imports as the Import Catalog Info feature in the new Sellercloud UI. You can learn more about that feature in this helpsite article.
Supported Import Types
The REST API support 6 different import types related to Catalog data:
Bulk Update Products
Use for creating products and updating existing products in your Sellercloud account. See this article for more information about this feature in the Sellercloud UI. Note: This is not intended for updating inventory in Sellercloud.Variations
Used for creating new variations (matrices) in bulk or adding products to an existing variation (matrix) in bulk. See this article for more information about this feature in the Sellercloud UI.Shadows. See this article for more information about this feature in the Sellercloud UI.
Kits. See this article for more information about this feature in the Sellercloud UI.
Product Images. See this article for more information about this feature in the Sellercloud UI.
Variation Images. See this article for more information about this feature in the Sellercloud UI.
In order to perform any one of the above import types via API, you should first download a dummy template and populate it with the information that will be imported. Downloading a template should be done in the SellerCloud UI.
1) Bulk Update Products
In order to do bulk update, you have to first download a dummy template from SellerCloud UI in one of the formats:
- TAB Delimited
- CSV
- Excel
You can choose the file format and the columns that you want to use. In the following video, we show how you can define your own custom template. Later it can be used for importing different kinds of product info in bulk via the REST API.
The endpoint for bulk update for the TT server is:
https://tt.api.sellercloud.com/rest/api/Catalog/Imports/Custom
The endpoint for another server will be:
https://{server_id}.api.sellercloud.com/rest/api/Catalog/Imports/Custom
More information about the endpoint can be found in Swagger as well:
Endpoint Usage
- Method Type: HttpPost
- Authorization: Use Bearer Token + token received from token authentication
- Header Info: Content-Type: application/json
- Body with information for the updated products in bulk
| Parameter | Data Type | Description | Is Required |
|---|---|---|---|
| Format | int | Format of the file that holds information for updated products. Mandatory. Tab Delimited = 0 CSV = 1 Excel = 2 |
Yes |
| FileContents | string | Content of the file in binary format and Base 64 encoded. Mandatory. | Yes |
| Metadata | object | Hold information about how to proceed with the new products, schedule task information etc. Mandatory Format: { "ScheduleDate": "", "CreateProductIfDoesntExist": true, "CompanyIdForNewProduct": 1, "UpdateFromCompanyId": 0 } |
Yes |
| FileExtension | string | The file extension of the encoded file. Some possible values are: .xls .xlsx .txt .csvTypically optional, but required when file extension is .xlsx |
No |
Important!
Keep in mind that if you are going to create new products via the bulk update, some metadata is required and you need to provide it in the template:
- If client setting "Require SiteCost and Buyer/Purchaser while creating product" is enabled, then site cost and purchaser are required for the new product.
- If client setting "Require Manufacturer when creating Product." is enabled, then manufacturer must be provided for the new product.
Response
- If user is authenticated and provides valid information in the request, then response will be Status Code 200 => OK and a link to the newly generated queued job.
- If user is not authenticated, then response will be Status Code 401 => Unauthorized
- On server error => Status Code 500 => Internal Server Error
Example Response
{
"QueuedJobLink": "Your bulk update has been queued. Job # 28163. Click here To monitor Schedule",
"ID": 283163
}
Example Demo in C#
public enum FileFormatType
{
TAB_Delimited = 0,
CSV = 1,
Excel = 2
}
public class BulkUpdateMetadata
{
public DateTime? ScheduleDate { get; set; }
public bool CreateProductIfDoesntExist { get; set; }
public int CompanyIdForNewProduct { get; set; }
public int UpdateFromCompanyId { get; set; }
public bool DoNotUpdateExistingProducts { get; set; }
}
public class Request
{
public BulkUpdateMetadata Metadata { get; set; }
public string FileContents { get; set; }
public FileFormatType Format { get; set; }
}
string url = "http://cwa.api.sellercloud.com/api/Catalog/Imports/Custom";
string token = "test_token";
int companyID = 1;
var content = new Request()
{
FileContents = Convert.ToBase64String(File.ReadAllBytes($@"C:DataTestRunsBulk.xls")),
Format = FileFormatType.Excel,
Metadata = new BulkUpdateMetadata()
{
CompanyIdForNewProduct = companyID
}
};
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;
await client.SendAsync(request);
}
}
2) Variations Import
Downloading a template for importing variations can happen from Sellercloud UI and from REST API.
Endpoint For Downloading Variations Template
Example for such endpoint for TT server is https://tt.api.sellercloud.com/rest/api/Catalog/Imports/Variations/Template?fileFormat=2
Request for Downloading Variations Template
enum FileFormatType
{
TAB_Delimited = 0,
CSV = 1,
Excel = 2
}
Response for downloading variations template
- If user is authenticated then response will be Status Code 200 => OK
- Content of the response will be Base-64 encoded array of bytes, that represent the file content. Client needs to decode and use the bytes array.
- Name of the file can be found in the response content header Content-Disposition.
- If user is not authenticated, then response will be Status Code 401 => Not Valid Token
- On server response => Status Code 500 => Internal Server Error
Demo in C# for downloading variations template
static async Task DownloadingVariationTemplate()
{
string token = "test_token";
string url = "localhost:8080/api/Catalog/Imports/Variations/Template?fileFormat=2";
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);
}
}
Endpoint for importing variations
https://{server_id}.api.sellercloud.com/rest/api/Catalog/Imports/Variations
3) Shadows Import
Downloading a template that will be used for importing shadows can be done from SellerCloud UI and from REST API.
Endpoint for downloading shadows template
Example for such endpoint for TT server is https://tt.api.sellercloud.com/rest/api/Catalog/Imports/Shadows/Template?fileFormat=2
Request for importing shadows
Endpoint for importing shadows is:
https://{server_id}.api.sellercloud.com/rest/api/Catalog/Imports/Shadows
4) Kits Import
Downloading a template that will be used for importing kits can be done from SellerCloud UI and from REST API.
Endpoint for downloading kit template
Example for such endpoint for TT server is https://tt.api.sellercloud.com/rest/api/Catalog/Imports/Kits/Template?fileFormat=2
Request for importing kits
Endpoint for importing kits is:
https://{server_id}.api.sellercloud.com/rest/api/Catalog/Imports/Kits
5) Product Images Import
Downloading a template that will be used for importing product images can be done from SellerCloud UI and from REST API.
Endpoint for downloading product images template
Endpoint for downloading product images template is:
https://{server_id}.api.sellercloud.com/rest/api/Catalog/Imports/Images/Template
6) Variations Images Import
Downloading a template that will be used for importing variations images can be done from SellerCloud UI and from REST API.
Endpoint for uploading variations images
https://{server_id}.api.sellercloud.com/api/Catalog/Imports/Variations/Images