singer-io / tap-bigcommerce

A Singer.io tap for extracting data from the BigCommerce API
GNU Affero General Public License v3.0
6 stars 17 forks source link

tap-bigcommerce

This is a Singer tap that produces JSON-formatted data following the Singer spec for BigCommerce.

Quick Start

  1. Set up a virtual environment and install this tap. See the Singer-io Getting Started Guide for help.

  2. Create the config.json file.

    {
      "client_id": "xxxxxxxxx",
      "access_token": "xxxxxxxxx",
      "store_hash": "xxxxxxxxx",
      "start_date": "2017-01-01T00:00:00Z"
    }
  3. Run the tap in Discovery Mode to create the Catalog.

    $ tap-bigcommerce --config config.json --discover > catalog.json
  4. Select the fields you wish to sync. See Field Selection below for more information.

  5. Run the tap in Sync Mode.

    $ tap-bigcommerce --config config.json --catalog catalog.json

About this tap

The Config

The config file is used to authenticate into BigCommerce. The Legacy API credentials not accepted.

start_date is used for resources that can be filtered by date_modified - orders, customers and products

Discovery mode

This command returns a JSON that describes the schema of each table.

$ tap-bigcommerce --config config.json --discover

To save this to catalog.json:

$ tap-bigcommerce --config config.json --discover > catalog.json

Field selection

You can tell the tap to extract specific fields by editing catalog.json to make selections (or use the Singer Discover utility. You can change metadata for specific fields or tables and change the "selected" field value to false.

"metadata": [
  {
    "breadcrumb": [],
    "metadata": {
      "table-key-properties": [
        "id"
      ],
      "forced-replication-method": "INCREMENTAL",
      "selected-by-default": true,
      "valid-replication-keys": [
        "date_modified"
      ]
    }
  },
  {
    "breadcrumb": [
      "properties",
      "id"
    ],
    "metadata": {
      "inclusion": "automatic",
      "selected": true
    }
  },
  ...

Sync Mode

With an annotated catalog.json, the tap can be invoked in sync mode:

$ tap-bigcommerce --config config.json --catalog catalog.json

Messages are written to standard output following the Singer specification. The resultant stream of JSON data can be consumed by a Singer target.

Replication Methods and State File

Use the following command to pipe the tap output into your Singer target of choice and update the state file in one go.

tap-bigcommerce --config config.json --catalog catalog.json --state state.json | target > state.json.tmp && tail -1 state.json.tmp > state.json

Copyright © 2019 Stitch