Actualizar Variaciones de un Producto en una Tienda¶
-
PUT
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 actualizar las imagenes de la variación, 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¶
PUT https://api.software.madkting.com/shops/2/products/123/variations/ HTTP/1.1
Accept: application/json
Authorization: Token 54f2d8bcfc49e7821da31a83ab95e40213c0a5c1
{
"availability": "in_stock",
"color": "negro",
"condition": "refurbished",
"discount": 3,
"discount_from": "2016-11-24T05:30:29",
"discount_to": "1993-07-08T12:36:42",
"images": [
{
"pk": 272
}
],
"pk": 1569,
"price": 58637194.452,
"secondary_color": "agua",
"size": "34a",
"sku": "uzzXMqqdwi",
"stock": 36
}
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¶
PUT https://api.software.madkting.com/shops/2/products/123/variations/ HTTP/1.1
Accept: application/json
Authorization: Token 54f2d8bcfc49e7821da31a83ab95e40213c0a5c1
[
{
"availability": "preorder",
"color": "azul acero",
"condition": "new",
"discount": 2,
"discount_from": "2005-03-30T11:47:14",
"discount_to": "1972-06-14T03:33:57",
"images": [
{
"pk": 272
}
],
"pk": 1569,
"price": -7.227,
"secondary_color": "lila",
"size": "13",
"sku": "FhEqsNKoLe",
"stock": 43
},
{
"availability": "out_of_stock",
"color": "piel",
"condition": "refurbished",
"discount": 49,
"discount_from": "2013-10-04T10:17:35",
"discount_to": "2015-05-21T09:37:27",
"images": [
{
"pk": 272
}
],
"pk": 1570,
"price": -434061.99,
"secondary_color": "rosa",
"size": "14.5",
"sku": "BhNLgvopyl",
"stock": 43
},
{
"availability": "preorder",
"color": "azul cielo",
"condition": "used",
"discount": 22,
"discount_from": "2005-05-06T01:47:41",
"discount_to": "1974-02-09T16:16:55",
"images": [
{
"pk": 272
}
],
"pk": 1571,
"price": -10033890761.8553,
"secondary_color": "terracota",
"size": "30",
"sku": "aHuDhQDICt",
"stock": 20
},
{
"availability": "preorder",
"color": "celeste",
"condition": "new",
"discount": 4,
"discount_from": "2008-03-08T09:46:06",
"discount_to": "1988-01-27T01:45:14",
"images": [
{
"pk": 272
}
],
"pk": 1572,
"price": 7394179819.4,
"secondary_color": "salmon",
"size": "32dd",
"sku": "HGiMMgDBXT",
"stock": 10
},
{
"availability": "in_stock",
"color": "beige",
"condition": "used",
"discount": 23,
"discount_from": "2008-10-13T11:13:46",
"discount_to": "1979-04-17T23:23:29",
"images": [
{
"pk": 272
}
],
"pk": 1573,
"price": 922744727117.581,
"secondary_color": "azul oscuro",
"size": "34b",
"sku": "GWxCuQhGwf",
"stock": 28
},
{
"availability": "in_stock",
"color": "agua",
"condition": "new",
"discount": 49,
"discount_from": "2014-02-18T14:28:28",
"discount_to": "1994-05-14T10:35:07",
"images": [
{
"pk": 272
}
],
"pk": 1574,
"price": -9656070.35102,
"secondary_color": "azul oscuro",
"size": "38dd",
"sku": "hudzgicYmN",
"stock": 24
}
]
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