Crear Variaciones de un Producto en una Tienda¶
-
POST
https://api.software.madkting.com/shops/
(shop_pk)/products/
(product_pk)/variations/
¶ Parameters: - shop_pk – El id de la tienda en la que pertenece el producto.
- product_pk – Id del producto al que se le quiere crear variaciones
Objeto de peticion Variación
En el caso del objeto de Image solo se envia el campo de
pk
del producto padre para agregar las variacines, ejemplo:[ { "pk": 2050 }, { "pk": 2055 } ]
Objeto de respuesta Feed
Status Codes: - 201 Created – Se creo el feed, para consultar el estado usar la url de la cabezera
location
. - 400 Bad Request – Alguno de los campos no se enviaron o no son del tipo correcto.
- 404 Not Found – El id de la tienda o producto no existe.
- 500 Internal Server Error – Error interno.
Ejemplo con 1 Variación¶
Ejemplo de petición¶
POST https://api.software.madkting.com/shops/2/products/123/variations/ HTTP/1.1
Accept: application/json
Authorization: Token 54f2d8bcfc49e7821da31a83ab95e40213c0a5c1
{
"availability": "in_stock",
"color": "agua",
"condition": "new",
"discount": 2,
"discount_from": "1987-02-04T17:20:41",
"discount_to": "2015-09-12T15:19:54",
"images": [
{
"pk": 272
}
],
"price": 93123693114.866,
"secondary_color": "azul acero",
"size": "4.5",
"sku": "rLItccXoeu",
"stock": 22
}
Ejemplo de respuesta¶
HTTP/1.1 201 CREATED
Vary: Accept
Content-Type: application/json
Location: https://api.software.madkting.com/feeds/WsS4nORWt9RGGaQTgxFOuWxC1d5hWwg1/
Allow: GET, PUT, POST, DELETE, OPTIONS
Ejemplo con varias Variaciones¶
Ejemplo de petición¶
POST https://api.software.madkting.com/shops/2/products/123/variations/ HTTP/1.1
Accept: application/json
Authorization: Token 54f2d8bcfc49e7821da31a83ab95e40213c0a5c1
[
{
"availability": "preorder",
"color": "piel",
"condition": "used",
"discount": 27,
"discount_from": "1986-10-08T10:45:06",
"discount_to": "1974-02-05T16:35:25",
"images": [
{
"pk": 272
}
],
"price": -358.777506072,
"secondary_color": "celeste",
"size": "42dd",
"sku": "hVvjMSANNV",
"stock": 26
},
{
"availability": "in_stock",
"color": "verde claro",
"condition": "new",
"discount": 50,
"discount_from": "1990-06-14T12:39:26",
"discount_to": "2015-06-21T17:26:08",
"images": [
{
"pk": 272
}
],
"price": 57858385.332164,
"secondary_color": "cafe",
"size": "40dd",
"sku": "oklDXkHdAJ",
"stock": 9
},
{
"availability": "out_of_stock",
"color": "purpura",
"condition": "used",
"discount": 11,
"discount_from": "1996-05-08T18:21:34",
"discount_to": "1980-05-21T01:06:32",
"images": [
{
"pk": 272
}
],
"price": 31215144.866,
"secondary_color": "vino",
"size": "28",
"sku": "TRFfJykgmY",
"stock": 13
},
{
"availability": "preorder",
"color": "salmon",
"condition": "refurbished",
"discount": 18,
"discount_from": "2008-01-31T08:25:55",
"discount_to": "2016-10-29T11:55:48",
"images": [
{
"pk": 272
}
],
"price": -779156.551199284,
"secondary_color": "vino",
"size": "3-4 years",
"sku": "cRVmcqiUpZ",
"stock": 29
},
{
"availability": "out_of_stock",
"color": "azul oscuro",
"condition": "used",
"discount": 36,
"discount_from": "1984-02-21T05:10:12",
"discount_to": "1982-06-20T05:25:45",
"images": [
{
"pk": 272
}
],
"price": -61272.203,
"secondary_color": "azul",
"size": "40c",
"sku": "HmIuoPQVfT",
"stock": 10
}
]
Ejemplo de respuesta¶
HTTP/1.1 201 CREATED
Vary: Accept
Content-Type: application/json
Location: https://api.software.madkting.com/feeds/WsS4nORWt9RGGaQTgxFOuWxC1d5hWwg1/
Allow: GET, PUT, POST, DELETE, OPTIONS