TB.One > Import & Export > REST Calls & the API > Stock Update Via XML and REST-API

Stock Update Via XML and REST-API

With TB.One's REST API, stock updates can be uploaded directly. This allows you to circumvent the schedule for import jobs and run stock updates at any time. It is appropriate to use this method if you want to keep stock numbers of previously registered articles up-to-date during the processing of large product data catalogues.

ATTENTION:
Stock updates via REST API are only viable if stock numbers are changed with this method exclusively.

The files are processed directly. Therefore, the response time of the the REST call depends directly on the file's size. This method of updating stock numbers is not suitable for files larger than 10 MB.

THE REST CALL

TIP:
Structure of the REST URI: https://rest.core.tradebyte.com/ACCOUNT-NR/articles/stock

"ACCOUNT-NR" is a placeholder for your TB.One account number

SEND STOCK UPDATES

METHOD

POST

Sends

ACCOUNT-NR

Your account number

to your TB.One system

TARGET/RESOURCE

articles/stock

an inventory list

EXAMPLE

https://rest.core.tradebyte.com/9951/articles/stock

TO SEND

The inventory file "TBCAT_STOCK_[timestamp].xml" (naming convention) for import has the following content:

One central warehouse:

<TBSTOCK>

 <ARTICLE>

         <A_NR>3810b1M</A_NR>

         <A_STOCK>15</A_STOCK>

 </ARTICLE>

 <ARTICLE>

         <A_NR>564721</A_NR>

         <A_STOCK>8</A_STOCK>

 </ARTICLE>

</TBSTOCK>

 

Several warehouses:

<TBSTOCK>

 <ARTICLE>

         <A_NR>3810b1M</A_NR>

         <A_STOCK identifier="key" key="zentrallager">10</A_STOCK>

         <A_STOCK identifier="key" key="aussenlager">5</A_STOCK>

 </ARTICLE>

</TBSTOCK>

 

The XML scheme can be found at:

https://api.core.tradebyte.com/schema/all_in_one/tb-stock_all_in_one.xsd

 

After pushing your file, the API will return a status message with a status code in the HTTP header:

bullet_20x10200 (all codes starting with 2xx): Call/processing successful

bullet_20x10400 (all codes starting with 4xx): Call not successful/request faulty

 


For further information, see also:

Providing stock data as part of the product data catalogue (XML, CSV)