Skip to content

sharetribe/flex-sdk-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

485d976 · Jul 1, 2024
Mar 14, 2023
May 27, 2024
May 20, 2024
Apr 17, 2019
May 27, 2024
May 20, 2024
Mar 21, 2017
Nov 23, 2018
May 28, 2024
Jul 1, 2024
Jan 10, 2017
Jun 10, 2024
May 27, 2024
Oct 26, 2023
Mar 15, 2023
May 14, 2024

Repository files navigation

Sharetribe SDK for JavaScript

Use Sharetribe Marketplace API with ease.

CircleCI

Table of Contents

What is it?

The SDK is the easiest way to interact with Sharetribe Marketplace API and Asset Delivery 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.

Installation

Yarn:

yarn add sharetribe-flex-sdk

Usage

const sharetribeSdk = require('sharetribe-flex-sdk');

// Create new SDK instance
// To obtain a client ID, see Applications in Console
const sdk = sharetribeSdk.createInstance({
  clientId: '<Your Client ID here>'
});

// Query first 5 listings
sdk.listings
  .query({ perPage: 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}`);
  });

Client ID is required to create a new SDK instance. See this article to learn how to create an application and get the client ID.

Examples

See examples/ directory in Github repository.

Documentation

Documentation can be found here.

Changelog

See CHANGELOG.md.

License

Distributed under The Apache License, Version 2.0