Socket
Socket
Sign inDemoInstall

@agnostack/bigcommerce-request

Package Overview
Dependencies
3
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @agnostack/bigcommerce-request

Please contact agnoStack via info@agnostack.com for any questions


Version published
Weekly downloads
4
increased by300%
Maintainers
1
Install size
290 kB
Created
Weekly downloads
 

Readme

Source

@agnostack/bigcommerce-request

🎮 Minimal BigCommerce API request library for Node

Installation

yarn add @agnostack/bigcommerce-request # npm install @agnostack/bigcommerce-request

Quickstart (OAuth)

const { createClient } = require('@agnostack/bigcommerce-request');
// import { createClient } from '@agnostack/bigcommerce-request'

const bigcommerce = new createClient({
  store_id: '...', // BigCommerce Store Name.
  client_id: '...', // BigCommercie Client Name.
  access_token: '...', // BigCommerce OAuth token.
});

bigcommerce
  .get('v3/catalog/products')
  .then(console.log)
  .catch(console.error);

bigcommerce
  .post('v3/customers', {
    first_name: 'Jane'
    last_name: 'Doe',
    email: 'johndoe@email.com'
  })
  .then(console.log)
  .catch(console.error);

bigcommerce
  .put('v3/customers', {
    id: 1,
    company: 'Company Name',
    first_name: 'Jane'
    last_name: 'Doe',
    email: 'johndoe@email.com',
    phone: '123456788900'
  })
  .then(console.log)
  .catch(console.error);

Kitchen sink

const bigcommerce = new createClient({
  store_id: '...',
  client_id: '...',
  access_token: '...',
  headers: {
    // ...
  }
});

Custom headers per request

The API provides you the ability to send various request headers that change the way data is stored or retrieved.

By default this library will encode all data as JSON, however you can customise this by setting your own Content-Type header as an additional argument to get, patch, post, put and delete.

Note: If you add the Content-Type custom header to patch, post, put or delete you will need to encode data yourself.

const bigcommerce = new createClient({
  store_id: '...',
  client_id: '...',
  access_token: '...'
});

const headers = {
  'X-My-Header': 'custom'
};

bigcommerce
  .get('v3/catalog/products', headers)
  .then(console.log)
  .catch(console.error);

Contact Adam Grohs @ agnoStack for any questions.

Keywords

FAQs

Last updated on 07 Jan 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc