--- title: API Reference language_tabs: - http toc_footers: - bitRec search: true ---
Thank you very much for choosing bitREC as your recommender system provider. This is bitREC's API documentation. Please read this document carefully in order to make the integration process smooth and swift. In case you would need support or more information, do not hesitate to contact our helpful technicians: support@bitrec.com. # Data Upload This section explains how to properly manage historical data exchange between your systems and bitREC. Data upload functions are used for regular data (carts, catalog, customers) uploads/updates to bitREC recommender system. ## Cart Items ```http POST /client-services/data_upload/carts HTTP/1.1 Host: recs.bitrec.com Content-Type: application/json [{"customerId" : "14", "buId" : "online1","orderTimestamp": "2013-07-10T12:20:00.000", "bonusCode": "ASD4221", "discount": 5.0, "items": [{"itemId":"Samsung SIII", "price":500.99, "quantity": 2, "discount": 5.0}, {"itemId":"Samsung cover flip", "price":45.50, "quantity": 1}, {"itemId":"auto charger", "price":14.00, "quantity": 1}]}, ...] ``` ```shell # Curl command from shell: curl -v -H "Content-Type: application/json" -X POST -d '[{"customerId" : "14", "buId" : "online1","orderTimestamp": "2013-07-10T12:20:00.000", "bonusCode": "ASD4221", "discount": 5.0, "items": [{"itemId":"Samsung SIII", "price":500.99, "quantity": 2, "discount": 5.0}, {"itemId":"Samsung cover flip", "price":45.50, "quantity": 1}, {"itemId":"auto charger", "price":14.00, "quantity": 1}]}]' http://user:pass@recs.bitrec.com/client-services/data_upload/carts ``` > UploadCart JSON format: ```json {"customerId" : "", "buId" : "", "orderTimestamp": "", "bonusCode": , "discount": , "items": [{"itemId":"", "price":4.45, "quantity": 2, "discount": }, ...] } ``` This function is used to regularly upload cart information. Usually it is enough to upload carts once in 24 hours. * If customerId, buId or any of itemId are found in our system, they will be automatically created without further details. These details can be later updated using appropriate APIs. * If orderTimestamp is missing, current time will be used. ### HTTP Request `POST https://:@//data_upload/carts` ### Body Parameters Parameter | Required | Description --------- | ---- | ------- | ----------- UploadCart obj. list | Yes | List of Cart item objects in JSON format #### UploadCart object Field | Required | Type | Description ----- | -------- | ---- | ------ customerId | Yes | String | ID of customer orderTimestamp | Yes | String (Format for date is "yyyy-MM-ddTHH:mm:ss.ms") | Time of cart purchase buId | No | String | Business unit, where cart was sold bonusCode | No | String | bonus code for a cart discount | No | Float | discount on all items in this cart, in money value (not percentage value). Not required, it's possible to assign discount to whole cart, or set discount for separate cart items. items | Yes | List of UploadCartItem objects | List of cart items #### UploadCartItem object Field | Required | Type | Description ----- | -------- | ---- | ------ itemId | Yes | String | ID of item price | Yes | Float | Price of item quantity | No | Integer | items' quantity in the cart discount | No | Float | discount for this item, in money value (not percentage value). ### Response Code | Description --- | -------- 204 | Request was successfully completed 400 | Bad request – mostly due wrong sending parameters structure 500 | Internal server error ## Items ```http POST /client-services/data_upload/items HTTP/1.1 Host: recs.bitrec.com Content-Type: application/json [{"itemId" : "456821", "price": 12.4, "category1Id": "1544|489|1444", "category2Id": "789|4555|4788", "name": "Nikon D3200", "description" : "Nikon D3200 Digital SLR Camera With AF-S DX NIKKOR 18-55mm", "deliveryTime": 1, "discount": 0.0, "buIds": ["shop L1", "shop L2"], "active": true},...] ``` ```shell # Curl command from shell: curl -v -H "Content-Type: application/json" -X POST -d '[{"itemId" : "456821", "price": 12.4, "category1Id": "1544|489|1444", "category2Id": "789|4555|4788", "name": "Nikon D3200", "description" : "Nikon D3200 Digital SLR Camera With AF-S DX NIKKOR 18-55mm", "deliveryTime": 1, "discount": 0.0, "buIds": ["shop L1", "shop L2"], "active": true}]' http://user:pass@recs.bitrec.com/client-services/data_upload/items ``` > UploadCart JSON format: ```json {"itemId" : "", "name" : "", "description" : "", "price" : "", "category1Id" : "", "category2Id" : "", "category3Id" : "", "category4Id" : "", "category5Id" : "", "category6Id" : "", "deliveryTime": "