mercadolibre-nodejs-sdk
v3.0.1
Published
This is the official NodeJS SDK for the MercadoLibre Marketplace platform.
Downloads
55
Readme
Installation
npm install mercadolibre-nodejs-sdk --save
Usage
var meli = require('mercadolibre-nodejs-sdk');
let apiInstance = new meli.ItemsApi();
let id = "id_example"; // String |
apiInstance.itemsIdGet(id, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
});
Or you can use the RestClient
var meli = require('mercadolibre-nodejs-sdk');
let apiInstance = new meli.RestClientApi();
let resource = "resource_example"; // String |
let accessToken = "accessToken_example"; // String |
apiInstance.resourceGet(resource, accessToken, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
});
Example using the RestClient with a POST Item
var meli = require('mercadolibre-nodejs-sdk');
var meli = require('mercadolibre-nodejs-sdk');
const InlineObject = {
"title": "Item de test - No Ofertar",
"category_id": "MLA5991",
"price": "350",
"currency_id": "ARS",
"available_quantity": "12",
"buying_mode": "buy_it_now",
"listing_type_id": "bronze",
"condition": "new",
"description": "Item de Teste. Mercado Livre SDK",
"video_id": "RXWn6kftTHY",
"pictures": [
{
"source": "https://upload.wikimedia.org/wikipedia/commons/f/fd/Ray_Ban_Original_Wayfarer.jpg"
}
]
};
let apiInstance = new meli.RestClientApi();
let resource = "resource_example"; // Example "items" |
let accessToken = "accessToken_example"; // String |
let body = InlineObject; // Object |
apiInstance.resourcePost(resource, accessToken, body, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
});