POST /api/rest/product/new

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

application/json

Body Required

  • productos array[object] Required

    At least 1 element.

    Hide productos attributes Show productos attributes object

Responses

  • 200 application/json

    Product(s) created successfully

    Hide response attribute Show response attribute object
    • insert_producto object Required

      Additional properties are allowed.

      Hide insert_producto attributes Show insert_producto attributes object
      • returning array[object] Required
        Hide returning attributes Show returning attributes object
        • id string(uuid) Required
        • dimension object

          Additional properties are allowed.

          Hide dimension attribute Show dimension attribute object
          • id_dimension string(uuid)
      • affected_rows integer Required
  • 400 application/json

    Bad request

    Hide response attributes Show response attributes object
    • path string
    • error string Required
    • code string Required
  • default application/json

    Unexpected error

    Hide response attributes Show response attributes object
    • error string Required
    • code string Required
    • path string
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)
{
  "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": "$"
}