Use Sharetribe Flex Marketplace API with ease.
The SDK is the easiest way to interact with Sharetribe Flex Marketplace API.
It handles groundwork such as authentication, renewing authentication tokens and serializing and deserializing data to and from JavaScript data structures.
This lets you to concentrate on building your marketplace front-end instead of setting up the necessary boilerplate to communicate with the API.
Yarn:
yarn add sharetribe-flex-sdk
const sharetribeSdk = require('sharetribe-flex-sdk');
// Create new SDK instance
const sdk = sharetribeSdk.createInstance({
clientId: '<Your Client ID here>'
});
// Query first 5 listings
sdk.listings
.query({ per_page: 5 })
.then(res => {
// Print listing titles
res.data.data.forEach(listing => {
console.log(`Listing: ${listing.attributes.title}`)
});
})
.catch(res => {
// An error occurred
console.log(`Request failed with status: ${res.status} ${res.statusText}`);
});
See examples/ directory in Github repository.
Documentation can be found here.
See CHANGELOG.md.
Distributed under The Apache License, Version 2.0