Create Product
Description:
The product creation endpoint allows you to create a new product in the Rayo system. You need to provide the following information:
- Your Rayo JWT Token
- Product name
- Product SKU
- Product UPC
- Product image reference
- Product dimensions (height, width, length, weight, volume),
- Units of measurement for the product's dimensions (centimeters, inches, pounds, ounces) * Currently centimeters is only allowed and set by default.
- Unit of measurement for the product's weight (grams, pounds). * Currently grams is only allowed and set by default.
Parameter | Description |
---|---|
nombre (String) - Required |
product name |
SKU (String) - Required |
Unique store identifier |
UPC (String) - Required |
Barcode unique identifier |
imagen_url(String) - Required |
product image reference |
altura (Float) - Required |
height |
ancho (Float) - Required |
width |
largo (Float) - Required |
length |
peso (Float) - Required |
weight |
volumen (Float) - Required |
Calculated volume (based on given width x length x height) |
POST /api/rest/product/new
curl \
-X POST cerebro.techrayo.com/api/rest/product/new \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"productos":[{"nombre":"Prueba 01","imagen_url":"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcStGTBLghQTK_dOR1REVYE8rhCbGLpKKSKEdA\u0026usqp=CAU","sku":"regalo001","upc":"","dimension":{"data":{"altura":"1","ancho":"1","largo":"1","peso":"3","volumen":"1"}}}]}'
Request example
{
"productos": [
{
"nombre": "Prueba 01",
"imagen_url": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcStGTBLghQTK_dOR1REVYE8rhCbGLpKKSKEdA&usqp=CAU",
"sku": "regalo001",
"upc": "",
"dimension": {
"data": {
"altura": "1",
"ancho": "1",
"largo": "1",
"peso": "3",
"volumen": "1"
}
}
}
]
}
Request examples
{
"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)
# Headers
Date: Fri, 27 May 2022 18:59:20 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
x-request-id: 7df6a5d4a419acafaa72a4847f5d2616
Content-Encoding: gzip
CF-Cache-Status: DYNAMIC
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Content-Security-Policy: upgrade-insecure-requests
Referrer-Policy: strict-origin-when-cross-origin
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 0
Server: cloudflare
CF-RAY: 7120fcaf6f5efeb6-IAH
# Payload
{
"insert_producto": {
"returning": [
{
"id": "9333ae33-82f2-4961-9234-c9fb0dbcbe65",
"dimension": {
"id_dimension": "07404986-69ec-46a7-904c-eeefd7fd6ff4"
}
}
],
"affected_rows": 2
}
}
Response examples (200)
# Headers
Date: Fri, 27 May 2022 18:59:20 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
x-request-id: 7df6a5d4a419acafaa72a4847f5d2616
Content-Encoding: gzip
CF-Cache-Status: DYNAMIC
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Content-Security-Policy: upgrade-insecure-requests
Referrer-Policy: strict-origin-when-cross-origin
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 0
Server: cloudflare
CF-RAY: 7120fcaf6f5efeb6-IAH
# Payload
{}
Response examples (400)
SKU or UPC already used
# Headers
Date: Fri, 27 May 2022 19:03:38 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
CF-Cache-Status: DYNAMIC
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Content-Security-Policy: upgrade-insecure-requests
Referrer-Policy: strict-origin-when-cross-origin
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 0
Server: cloudflare
CF-RAY: 712102febfcdfeb6-IAH
# Payload
{
"path": "$.selectionSet.insert_producto.args.objects[0]",
"error": "Uniqueness violation. duplicate key value violates unique constraint \"producto_sku_id_cliente_key\"",
"code": "constraint-violation"
}
# Headers
Date: Fri, 27 May 2022 19:03:38 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
CF-Cache-Status: DYNAMIC
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Content-Security-Policy: upgrade-insecure-requests
Referrer-Policy: strict-origin-when-cross-origin
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 0
Server: cloudflare
CF-RAY: 712102febfcdfeb6-IAH
# Payload
{
"path": "$.selectionSet.insert_producto.args.objects[0]",
"error": "check constraint of an insert/update permission has failed",
"code": "permission-error"
}
Response examples (400)
# Headers
Date: Fri, 27 May 2022 19:03:38 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
CF-Cache-Status: DYNAMIC
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Content-Security-Policy: upgrade-insecure-requests
Referrer-Policy: strict-origin-when-cross-origin
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 0
Server: cloudflare
CF-RAY: 712102febfcdfeb6-IAH
# Payload
{}