@busmarket/bmapi-js
v1.0.8
Published
BmApiJS | BusMarket API JS client
Downloads
11
Maintainers
Readme
BusMarket API JS client
Installation
npm i @busmarket/bmapi-js
You can find a full list of examples here.
https://developer.bm.parts/
Overview
Using JavaScript:
const BmApi = require('@busmarket/bmapi-js');
const myBmApi = new BmApi('<your_token>');
Using TypeScript:
import BmApi = require("@busmarket/bmapi-js");
const myBmApi = BmApi('<your_token>');
Engine
Every resource method returns a promise. For example, let's get list of products:
const BmApi = require('@busmarket/bmapi-js');
const myBmApi = new BmApi('<your_token>');
(async() => {
const response = await myBmApi.search.products({q: '115906'});
console.info(response.data);
})();
Browser
Also, you can use CDN. Following code bellow:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src="node_modules/@busmarket/bmapi-js/dist/cdn.bmapi.js"></script>
<script>
const MyBmApi = new BmApi(`<YOUR_BMAPI_TOKEN>`);
( async function() {
const QueryResponse = await MyBmApi.aggregations.brands({q: '115906'});
console.info(QueryResponse.data);
})();
</script>
</body>
</html>
Documentation
Documentation is available at https://developer.bm.parts