Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sr2ds/mercadolivre-public-api
API para consultas publicas do Mercado Livre
https://github.com/sr2ds/mercadolivre-public-api
javascript npm-package
Last synced: 5 days ago
JSON representation
API para consultas publicas do Mercado Livre
- Host: GitHub
- URL: https://github.com/sr2ds/mercadolivre-public-api
- Owner: sr2ds
- Created: 2019-03-07T12:44:51.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-03-19T14:00:46.000Z (over 5 years ago)
- Last Synced: 2024-10-16T09:17:33.143Z (29 days ago)
- Topics: javascript, npm-package
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Mercado Livre Public API
Consultas básicas do Mercado Livre
## Instalação
`npm install mercadolivre-public-api`
`import mercadolivre from 'mercadolivre-public-api'`
## Como utilizar
### Define o sellerId
```
mercadolivre.setSellerId(seller_id)
```### Retorna total de itens
```
let total = await mercadolivre.getTotalItens()
```### Retorna itens utilizando Offset
```
offset = 0;
let itens = await mercadolivre.getItens(offset)
```### Retorna todos os Itens
```
async function getItensComplete() {
let offset = 0;
let itens = null
let full_itens = []
this.total = await mercadolivre.getTotalItens()while (this.total >= full_itens.length) {
let itens = await mercadolivre.getItens(offset)
full_itens = full_itens.concat(await mercadolivre.getItens(offset));
offset += 50;
}
}
```