create_product
POST https://api.bootic.net/v1/shops/{id}/products
Use this relation to create a new product for a given shop.
This relation is available only for shops owned by your current scope and credentials (required scope: admin
).
This endpoint is in early development and might change in the future.
Consider this a BETA feature.
Consider this a BETA feature.
HTTP POST
$ curl -XPOST -H'Accept:application/json' -H'Content-Type:application/json' -H "Authorization: Bearer xxxx" -i https://api.bootic.net/v1/shops/:shop_id/products -d[REQUEST_BODY]
Request body
{
"title": "iPhone 5",
"price": 20020,
"price_comparison": 20122,
"description": "iPhone 5 by Apple",
"status": "visible",
"product_type_name": "Smart phones",
"tags": [
"communications",
"handheld"
],
"vendor": "Acme",
"variants": [
{
"title": "White",
"sku": "1234R",
"available_if_no_stock": 1,
"stock": 102,
"weight_in_grams": 340
},
{
"title": "Dark blue",
"sku": "1244R",
"available_if_no_stock": 0,
"stock": 10,
"weight_in_grams": 340
}
],
"custom_attributes": [
{
"name": "Colour",
"value": "red",
"field_type": "string",
"required": true
}
],
"collections": [
{
"id": 1234
},
{
"title": "A new collection"
}
]
}
- title
- Product title. Required.
- price
- Product price in cents (integer, no punctuation). Optional.
- price_comparison
- “Price before”, in cents (integer, no punctuation). Optional.
- description:
- Product description. Optional.
- status
- Product status (“visible” or “hidden”). Optional, default “hidden”.
- product_type_name
- Name for new or existing product type. If new it will be created. Optional.
- collections
- Array of collections with “id” or “title”. New ones (with only “title”) will be created. Optional.
- tags
- Array of tag names. New ones will be created. Optional.
- vendor
- Vendor name. It will be created it it doesn’t exist. Optional.
- variants
- Array of variant objects.
- custom_attributes:
- Array of custom attributes.
variant
- title
- Variant title. Required.
- sku
- SKU code, optional. Must be unique in the product’s shop.
- available_if_no_stock
- Variant availability policy.
0
for unavailable if out of stock.1
for always available. Default1
- stock
- Variant stock number. Default
1
. - weight_in_grams
- Variant weight in grams, no punctuation. Optional.
Collection
- title
- Collection title. Pass this if you want to create and assign a new collection to the product.
- id
- Collection unique ID. Pass this to assign an existing collection in your shop to a product.
Custom attribute
- name
- The attribute’s name, ex. “Colour”, “Material”, etc.
- value
- The attribute’s value, ex. “red”
- field_type
- One of “string”, “email”, “url”, “int”, “boolean”. Default “string”.
- required
- Required field boolean. Default
false
Successful response
Status: 201 Created
Content-Type: application/json; charset=utf-8
Connection: keep-alive
ETag: "0728e2965bd03e20a7f1c33add2f8775"
Last-Modified: Fri, 20 Jun 2014 22:34:14 GMT
Cache-Control: must-revalidate, private, max-age=0
Date: Wed, 31 Jul 2013 21:11:52 GMT
X-OAuth-Scopes: admin
{
"_links": {
"btc:web": {
"href": "http://www.bootic.net/products/producto-de-ejemplo-de-bootic",
"type": "text/html",
"title": "Web page for this product on its original shop front-end"
},
"self": {
"href": "https://api.bootic.net/v1/products/1234"
},
"btc:update_product": {
"href": "https://api.bootic.net/v1/shops/47/products/1234",
"title": "Update this product",
"method": "put"
},
"btc:delete_product": {
"href": "https://api.bootic.net/v1/products/1234",
"title": "Delete this product",
"method": "delete"
},
"btc:create_variant": {
"href": "https://api.bootic.net/v1/products/1234",
"method": "post",
"title": "Create a product variant"
},
"btc:create_product_asset": {
"href": "https://api.bootic.net/v1/products/1234/assets",
"method": "post",
"title": "Create a product asset"
}
},
"id": "producto-de-ejemplo-de-bootic",
"title": "Producto de ejemplo de Bootic",
"status": "visible",
"vendor": "Bootic",
"description": "Este es un producto de ejemplo en Bootic. Puedes editarlo, agregarle información, o bien borrarlo y empezar desde cero. Bienvenido!",
"price": 900,
"price_comparison": 1000,
"discount_percentage": 10.0,
"currency_code": "CLP",
"tags": [
"tag1",
"tag2"
],
"created_on": "2009-12-12T23:05:49.000Z",
"updated_on": "2012-09-01T19:44:40.000Z",
"_embedded": {
"shop": {
"_links": {
"self": {
"href": "https://api.bootic.net/v1/shops/47"
}
},
"id": "47",
"name": "Bootic",
"subdomain": "www",
"url": "www.bootic.net"
},
"variants": [
{
"_links": {
"btc:update_variant": {
"href": "http://api.bootic.net/v1/shops/455/product-de-ejemplo-de-bootic/variants/6440",
"method": "put"
},
"btc:delete_variant": {
"href": "http://api.bootic.net/v1/shops/455/product-de-ejemplo-de-bootic/variants/6440",
"method": "delete"
}
},
"title": "Default",
"id": 6440,
"stock": 1,
"available_if_no_stock": true,
"sku": null,
"weight_in_grams": 0,
"price": 900,
"price_comparison": 1000
}
],
"collections": [
{
"title": "Catálogo",
"id": 897,
"shop_id": 47,
"slug": "catalogo"
}
],
"custom_attributes": [
{
"id": 123433,
"name": "Colour",
"value": "red",
"field_type": "string",
"required": true,
"key": "colour"
}
],
"images": [
{
"_links": {
"thumbnail": {
"href": "https://o.btcdn.co/47/thumbnail/8848-Photo_2.jpg"
},
"small": {
"href": "https://o.btcdn.co/47/small/8848-Photo_2.jpg"
},
"medium": {
"href": "https://o.btcdn.co/47/medium/8848-Photo_2.jpg"
},
"large": {
"href": "https://o.btcdn.co/47/large/8848-Photo_2.jpg"
},
"original": {
"href": "https://o.btcdn.co/47/original/8848-Photo_2.jpg"
}
},
"file_name": "Photo_2.jpg",
"title": "test"
}
]
}
}
Invalid response
Status: 422 Unprocessable Entity
Content-Type: application/json; charset=utf-8
Connection: keep-alive
ETag: "0728e2965bd03e20a7f1c33add2f8775"
Last-Modified: Fri, 20 Jun 2014 22:34:14 GMT
Cache-Control: must-revalidate, private, max-age=0
Date: Wed, 31 Jul 2013 21:11:52 GMT
X-OAuth-Scopes: admin
{
"_class": [
"errors",
"product"
],
"_embedded": {
"errors": [
{
"_class": [
"error"
],
"field": "product.title",
"messages": [
"can't be blank"
]
}
]
}
}