Creates one or more new products in the Rayo system. Requires a valid JWT Bearer token. Units: Currently the API only allows and defaults to: - unidad_dimension: CENTIMETROS - unidad_peso: GRAMOS
POST
/api/rest/product/new
curl \
--request POST 'https://cerebro.techrayo.com/api/rest/product/new' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{"productos":[{"sku":"regalo001","upc":"","nombre":"Prueba 01","dimension":{"data":{"peso":"3","ancho":"1","largo":"1","altura":"1","volumen":"1"}},"imagen_url":"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcStGTBLghQTK_dOR1REVYE8rhCbGLpKKSKEdA\u0026usqp=CAU"}]}'
Request example
{
"productos": [
{
"sku": "regalo001",
"upc": "",
"nombre": "Prueba 01",
"dimension": {
"data": {
"peso": "3",
"ancho": "1",
"largo": "1",
"altura": "1",
"volumen": "1"
}
},
"imagen_url": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcStGTBLghQTK_dOR1REVYE8rhCbGLpKKSKEdA&usqp=CAU"
}
]
}
Response examples (200)
{
"insert_producto": {
"returning": [
{
"id": "9333ae33-82f2-4961-9234-c9fb0dbcbe65",
"dimension": {
"id_dimension": "07404986-69ec-46a7-904c-eeefd7fd6ff4"
}
}
],
"affected_rows": 2
}
}
Response examples (400)
SKU or UPC already used
{
"code": "constraint-violation",
"path": "$.selectionSet.insert_producto.args.objects[0]",
"error": "Uniqueness violation. duplicate key value violates unique constraint \"producto_sku_id_cliente_key\""
}
{
"code": "permission-error",
"path": "$.selectionSet.insert_producto.args.objects[0]",
"error": "check constraint of an insert/update permission has failed"
}
Response examples (default)
{
"error": "internal error",
"code": "unexpected",
"path": "$"
}