Publicaciones
Vincular vendedor con tienda
Para saber si el vendedor tiene una tienda creada, realiza una búsqueda con el site y seller id. Si tiene el tag mshops significa que tiene su tienda creada en Mercado Shops. En caso de no tener este tag, podrá crear una tienda en Mercado Shops.
Llamada:
curl -X GET -H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com/sites/$SITE_ID/search?seller_id=$SELLER_ID
Ejemplo:
curl -X GET -H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com/sites/MLB/search?seller_id=618515328
Respuesta:
{
"site_id":"MLB",
"seller":{
"id":618515328,
"nickname":"TETE1835554",
"permalink":"http://perfil.mercadolivre.com.br/TETE1835555",
"registration_date":"2020-07-31T09:59:53.000-04:00",
"seller_reputation":{
"level_id":"5_green",
"power_seller_status":null,
"transactions":{
"total":1,
"canceled":0,
"period":"historic",
"ratings":{
"negative":0,
"positive":0,
"neutral":1
},
"completed":1
},
"metrics":{
"sales":{
"period":"365 days",
"completed":1
}
}
},
"real_estate_agency":false,
"car_dealer":false,
"tags":[
"normal",
"test_user",
"mshops",
"messages_as_seller",
"messages_as_buyer"
],
"eshop":null
},
"paging":{
"total":0,
"primary_results":1000,
"offset":0,
"limit":50
},
"results":[ ],
"secondary_results":[ ],
"related_results":[ ],
"sort":{
"id":"relevance",
"name":"Mais relevantes"
},
"available_sorts":[
{
"id":"price_asc",
"name":"Menor preço"
},
{
"id":"price_desc",
"name":"Maior preço"
}
],
"filters":[ ],
"available_filters":[ ]
}
Publicar en Mercado Libre y/o Mercado Shops
Mediante el campo channels puedes definir en qué canal quieres publicar el ítem (Mercado Libre y/o Mercado Shops). Esta misma acción podrás realizarla en cualquier momento que quieras cambiar la publicación para algún canal en particular.
Ejemplo de ítem publicado solo en Mercado Shops:
curl -X POST -H 'Authorization: Bearer $ACCESS_TOKEN' -H "Content-Type: application/json" -d
{
[...]
"channels": ["mshops"]
[...]
}
https://api.mercadolibre.com/items
Ejemplo de ítem publicado solo en Mercado Libre:
curl -X POST -H 'Authorization: Bearer $ACCESS_TOKEN' -H "Content-Type: application/json" -d
{
[...]
"channels": ["marketplace"]
[...]
}
https://api.mercadolibre.com/items
Para más detalle, puedes consultar publicaciones de marketplace.
Ejemplo de ítem publicado en ambos canales:
curl -X POST -H 'Authorization: Bearer $ACCESS_TOKEN' -H "Content-Type: application/json" -d
{
[...]
"channels": ["marketplace",
"mshops"
]
[...]
}
https://api.mercadolibre.com/items
Editar canal de publicación
También puedes modificar el canal en el que se encuentre la publicación realizando un PUT al mismo recurso de /items.
Ejemplo de edición de publicación de marketplace a mshops:
curl -X PUT -H 'Authorization: Bearer $ACCESS_TOKEN' -H
{
[...]
"channels": ["mshops"]
[...]
}
https://api.mercadolibre.com/items
Crear o actualizar precio
Ejemplo:
curl -X POST-H 'Authorization: Bearer $ACCESS_TOKEN' -H "Content-Type: application/json" -d
{
[...]
"amount": 50000,
"currency_id":"ARS"
}
https://api.mercadolibre.com/items/$ITEM_ID/prices/types/standard/channels/mshops
Respuesta:
{
"prices": [
{
"id": "9",
"type": "standard",
"amount": 50000,
"regular_amount": null,
"currency_id": "ARS",
"last_updated": "2021-06-03T16:24:56Z",
"conditions": {
"context_restrictions": ["channel_mshops"],
"start_time": null,
"end_time": null
}
}]
[...]
}
Si deseas editar publicaciones de marketplace, puedes hacerlo con el recurso /items.
Eliminar precio
Al eliminar el precio en Mercado Shops puedes mantener un precio estándar, sin diferenciar las publicaciones de Mercado Libre y Mercado Shops.
Llamada:
curl -X DELETE -H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com/items/$ITEM_ID/prices/types/standard/channels/mshops
Consultar precio
Llamada:
curl -X GET -H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com/items/$ITEM_ID/prices/types/standard/channels/mshops
Ejemplo:
curl -X GET -H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com/items/MLA921502681/prices/types/standard/channels/mshops
Respuesta:
{
"id": "MLA921502681",
[...]
"prices": [
{
"id": "9",
"type": "standard",
"amount": 50000,
"regular_amount": null,
"currency_id": "ARS",
"last_updated": "2021-06-03T16:24:56Z",
"conditions": {
"context_restrictions": ["channel_mshops"],
"start_time": null,
"end_time": null
}
}]
[...]
}
Identificar el mejor precio
Para identificar el mejor precio de venta de una publicación de marketplace (Mercado Libre) o mshops (Mercado Shops) utiliza /sale_price y envía el parámetro context (channel_mshops o channel_marketplace) dependiendo el canal de la publicación.
Llamada:
curl -X GET-H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com/items/ITEM_ID/sale_price?context=CONTEXT
Ejemplo para el canal de Mercado Shops:
curl -X GET-H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com/items/4/sale_price?context=channel_mshops
Respuesta:
{
"price_id":"35"
"amount": 50000,
"regular_amount": null,
"currency_id": "ARS",
"last_updated": "2021-06-03T16:24:56Z"
}
Notificaciones sobre precios
Para recibir notificaciones sobre los precios, debes suscribirte al tópico items_prices. En la respuesta correspondiente recibirás:
{
"user_id": 1234567,
"resource": "/items/$ITEM_ID/prices"
}
Una vez recibida la novedad deberás consultar y conocer el nuevo estado de la entidad.
Llamada:
curl -X GET -H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com/items/$ITEM_ID/prices
Ejemplo:
curl -X GET -H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com/items/MLA921502681/prices
Respuesta:
{
"id": "MLA921502681",
[...]
"prices": [
{
"id": "9",
"type": "standard",
"amount": 50000,
"regular_amount": null,
"currency_id": "ARS",
"last_updated": "2021-06-03T16:24:56Z",
"conditions": {
"context_restrictions": ["channel_mshops"],
"start_time": null,
"end_time": null
}
}]
[...]
}
Errores
Error | Descripción | Solución |
---|---|---|
400 | Invalid json format | Enviar el JSON con el formato correcto |
400 | Price amount must be greater than zero | Ingresar un precio mayor a cero |
400 | Price amount is required | Completar el monto del precio (obligatorio) |
400 | Price currency_id is required | Completar el id de la moneda (obligatorio) |
400 | Currency xxxx is not valid | Ingresar moneda válida |
400 | Amount is over max decimal precision allowed for currency | Utilizar la cantidad correcta de decimales en el precio |
401 | Missing access_token param | Enviar tu access token en el header de la llamada |
403 | User ID must match the item owner | Utilizar el ID de usuario owner del ítem |
404 | Prices entity not found for itemxxxxx. It must be initialized before doing this operation | Usar el item ID correcto |
429 | Too many requests | Reducir la cantidad de llamadas |
Siguiente: Envíos gratis.