[POST] /catalogs/<CATALOG_ID>/products

Objetivo:

Cargar productos a un catálogo Botmaker

Primero es necesario crear un catálogo donde se agregarán los productos:

Crear Catálogo:

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'access-token: <TOKEN>' -d '{ \ 
   "title": "My Catalog", \ 
   "description": "My first catalog" \ 
 }' 'https://go.botmaker.com/api/v1.0/catalogs'

Se obtiene el CATALOG_ID del response:

{
  "id": "1BKOTFLQCVAG0BSTLF00"
}

Carga de Categoría:

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'access-token: <TOKEN>' -d '{ \ 
   "categories": [ \ 
     { \ 
       "title": "My Category", \ 
       "description": "My first category", \ 
       "code": "1" \ 
     } \ 
   ], \ 
   "upsert": true \ 
 }' 'https://go.botmaker.com/api/v1.0/catalogs/<CATALOG_ID>/categories'

Carga de productos:

curl --location --request POST 'https://go.botmaker.com/api/v1.0/catalogs/<CATALOG_ID>/products' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'access-token: <TOKEN>' \
--data-raw '{  
   "products": [  
     {  
       "sourceId": "1",  
       "title": "papa blanca",  
       "description": "papa blanca cepillada",  
       "keywords": "papa blanca",  
       "price": "1000",  
       "salePrice": "399",  
       "currency": "ARS",  
       "imageLink": "https://motegreenmarket.com.ar/wp-content/uploads/2020/02/papa-blanca.jpg",  
       "additionalImageLink_1": "https://motegreenmarket.com.ar/wp-content/uploads/2020/02/papa-blanca.jpg",
       "order": 0,  
       "categoryCode": "1",  
       "availability": "InStock"  
     }  
   ],  
   "upsert": true  
 }'

Estructura de request:

  • sourceId [string] Identificador del producto, usualmente llamado SKU.
  • title [string] Nombre del producto
  • description [string] Descripción del producto
  • keywords [string] Palabras claves para buscar el producto
  • price [string] Precio del producto
  • salePrice [string] Precio de oferta del producto (Opcional)
  • currency [string] Moneda local, utilizar el country ISO code https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
  • imageLink [string] Link de la imagen principal del producto
  • additionalImageLink_1 [string] Link de la imagen adicional del producto, se pueden ingresar hasta 5 imágenes. (Opcional)
  • order [string] Orden del producto
  • categoryCode [string] Código de la categoría (Opcional). Se debe crear una categoria previamente.
  • availability [string] Estado del producto. Opciones posibles: InStock | OutOfStock
  • upsert [boolean] Crea el producto en caso de no existir.

Producto con subitems:

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'access-token: <TOKEN>' -d '{ \ 
   "products": [ \ 
     { \ 
       "sourceId": "1234", \ 
       "title": "Combo de hamburguesa", \ 
       "description": "Descripción del combo", \ 
       "price": 500, \ 
       "salePrice": 400, \ 
       "currency": "ARS", \ 
       "isComposite": true, \ 
       "link": "https://media-cldnry.s-nbcnews.com/image/upload/t_fit-1240w,f_auto,q_auto:best/rockcms/2022-08/220805-border-collie-play-mn-1100-82d2f1.jpg", \ 
       "imageLink": "https://media-cldnry.s-nbcnews.com/image/upload/t_fit-1240w,f_auto,q_auto:best/rockcms/2022-08/220805-border-collie-play-mn-1100-82d2f1.jpg", \ 
       "color": 1, \ 
       "categoryCode": "1", \ 
       "availability": "InStock", \ 
       "additionalImageLink_1": "https://media-cldnry.s-nbcnews.com/image/upload/t_fit-1240w,f_auto,q_auto:best/rockcms/2022-08/220805-border-collie-play-mn-1100-82d2f1.jpg", \ 
       "compositeStructure": [ \ 
         { \ 
           "id": "4-O1", \ 
           "type": "SELECT", \ 
           "title": "Hamburguesa", \ 
           "values": [ \ 
             { \ 
               "id": 216, \ 
               "title": "Papas fritas", \ 
               "extraPrice": 29.9 \ 
             }, \ 
             { \ 
               "id": 217, \ 
               "title": "Bebida", \ 
               "extraPrice": 29.9 \ 
             } \ 
           ] \ 
         }, \ 
         { \ 
           "id": 335, \ 
           "title": "Mostaza", \ 
           "type": "CHECK", \ 
           "defaultValue": false, \ 
           "extraPrice": 69.9 \ 
         }, \ 
         { \ 
           "id": 338, \ 
           "title": "Mayonesa", \ 
           "type": "CHECK", \ 
           "defaultValue": false, \ 
           "extraPrice": 114.9 \ 
         }, \ 
         { \ 
           "id": 364, \ 
           "title": "Ketchup", \ 
           "type": "CHECK", \ 
           "defaultValue": false, \ 
           "extraPrice": 39.9 \ 
         } \ 
       ] \ 
     } \ 
   ], \ 
   "upsert": true \ 
 } \ 
 ' 'https://go.botmaker.com/api/v1.0/catalogs/<CATALOG_ID>/products'