This API is used for bulk uploading products and materials.
api/merchant/upload_products
params
type
- 1 for materials import
- 2 for models import
- 3 for posters
- 4 for carpets
- 5 for plinths
Method POST
request send with form-data format these fields:
dump - CSV file with content from 3D-models import, 3D-materials import
webhook_url - url to webhook page for receiving import result
x-token: 202cb962ac59075b964b07152d234b70
response
if success:
{
"status": "ok",
"data": {
"success": true
}
}
If it fails in response the server returns information with an index of rows and fields where the problem
{
"error": "validation_error",
"rows": {
"158": {
"gltf": [
"Gltf is invalid."
]
}
},
"status": "error"
}
Webhook response
when the server finishes processing all rows in the CSV file the server sends to webhook URL information about imported items with new/updated entityId from r2d engine
different type has different formats of response:
Material
[
{
"crm_id": "10477",
"index": 149,
"entity_id": 34507
},
{
"error": "error_import",
"index": 150,
"crm_id": "10478",
},
{
"crm_id": "10475",
"index": 151,
"entity_id": 34505
}
]
in the error case, you can see the row row index with an error.
Model
{
"status": "ok",
"data": [
{
"geometries": [
{
"name": "mesh_0",
"value": "536",
"source": "bank",
"order": "0",
"geometryId": "103408"
},
{
"name": "mesh_1",
"value": "1588",
"source": "bank",
"order": "1",
"geometryId": "103409"
},
{
"name": "mesh_2",
"value": "1555",
"source": "none",
"order": "2",
"geometryId": "103410"
}
],
"crmId": "123456781",
"entityId": "32755"
},
{
"geometries": [
{
"name": "mesh_3",
"value": "2924",
"source": "bank",
"order": "0",
"geometryId": "103411"
},
{
"name": "mesh_0",
"value": "882",
"source": "bank",
"order": "1",
"geometryId": "103412"
},
{
"name": "mesh_1",
"value": "839",
"source": "bank",
"order": "2",
"geometryId": "103413"
},
{
"name": "mesh_2",
"value": "1596",
"source": "bank",
"order": "3",
"geometryId": "103414"
}
],
"crmId": "123456782",
"entityId": "32756"
}
]
}
response format:
geometries list of geometry objects with fields:
- name - name of geometry
- source - the source of linked material (bank, set, none)
-- bank - merchant material catalog
-- set - fixed list items of materials
-- none - fixed material from uploaded model - value - default material id
- geometryId - system id of geometry
- order - order of geometry in model
crmId - imported CRM id
entityId - id of product in r2d system