Import Physical Inventory

Overview

This endpoint is for importing inventory in bulk via the Rest API. (For setting the physical inventory of an individual product via the REST API, see here instead.) This endpoint exposes the same functionality as the Import Physical Inventory feature in our new Sellercloud UI.

In order to do a bulk inventory import, you must first download an Import Physical Inventory template file from the Sellercloud UI in one of these formats:

  • TAB Delimited
  • CSV
  • Excel

See this article for assistance with getting a template file. After you’ve downloaded a template file and populated with inventory info (either manually or via code), you can proceed with importing that file via the REST API.

In order to import physical inventory in bulk, you must have a valid token, which is received after authentication. For information on how you can authenticate, see: Authentication

Endpoint

This would be the endpoint for the TT server:

https://tt.api.sellercloud.com/rest/api/Inventory/ImportPhysicalInventory

For your server, the endpoint will be:

https://{your_server_id}.api.sellercloud.com/rest/api/Inventory/ImportPhysicalInventory

Request

  • Method Type: HttpPut
  • Authorization: Use Bearer Token + token received from token authentication
  • Header info: Content-Type: application/json
ParameterData TypeDescriptionIs Required
UpdateTypeintPartial: 0

Full: 1

Optional.

Default value: Partial

Partial is strongly recommended. Full will set any SKU in the system that is not in the file to a quantity of zero.

No
FileContentstringBase64 encoded string, which represents file contentYes
FileExtensionstringThe file extension. Must be provided when the format is excel and the file is with extension “.xlsx”. Example “.xlsx”.No
InventoryDateDateTimeInventory Date

Optional.

Default value: current time of import.

No
FormatintTab Delimited: 0

CSV: 1

Excel: 2

Yes
WarehouseIDintID of the warehouse where the imported inventory should be setYes
PinCodestringPin CodeDepends, see below
MergeDefaultWarehouseInventoryIntoShadowParentboolIf to merge default warehouse inventory into shadow parent.

Optional.

Default Value: True

No
Pin code is required if client setting “Require PIN to change inventory quantity” is enabled.

Response

  • If inventory is imported successfully, then response will be Status Code 200 => OK
  • If token is not valid, then response will be Status Code 401 => Not Valid Token
  • Error on server response => Status Code 500 => Internal Server Error

Demo

Full
}

var content = new ImportBulkPhysicalInventoryRequest()
{
FileContents = Convert.ToBase64String(File.ReadAllBytes($@”C:DataTestRunsBulk.xls”)),
Format = FileFormatType.Excel,
UpdateType = PhysicalInventoryUpdateType.Partial,
InventoryDate = DateTime.Now,
MergeDefaultWarehouseInventoryIntoShadowParent = true
};

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;

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

public string FileContent { get; set; }

public DateTime? InventoryDate { get; set; }

public FileFormatType? Format { get; set; }

public int? WarehouseID { get; set; }

public string PinCode { get; set; }

public bool MergeDefaultWarehouseInventoryIntoShadowParent { get; set; }
}

Was this article helpful?

Next
Get RMA Saved Views