Skip to content

Basic import request

James Williamson edited this page Jul 13, 2018 · 10 revisions

It is best to start with a basic payload

Properties

  • meta: Contains information to be logged when the import has started.
  • settings: Used to control behaviour during Import.
  • data: Payload such as Companies, People, Users etc are placed in here.
{
  "meta": {
    "created_at": "2018-02-15T17:33:56+0000",
    "feed_name": "The corporation"
  },
  "settings": {
    "version": "0.0.1"
  },
  "data": {
    "people": [],
    "companies": [],
    "users": []
    }
  }
}

People, Companies and Users can contain objects that are imported. You can read more about this here

The Curl request for the API looks like this. You will have to authenticate beforehand. Instructions on how to get an Auth Token can be found here (https://dev.bookingbug.com/docs/rest-api/authentication).

curl -X POST \
  https://the-corporation.bookingbug.com/api/v1/admin/37000/imports \
  -H 'App-Id: XXXXXXX' \
  -H 'App-key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
  -H 'Auth-Token: xxxxxxxxxxxxxxxxxxxxxx' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -d '{
  "meta": {
    "created_at": "2018-06-27T09:40:15+01:00",
    "feed_name": "The corporation"
  },
  "settings": {
    "version": "0.0.1"
  },
  "data": {
    "companies": [
      {
        "name": "The name of a store or Branch",
        "external_id": "an_id",
        "object_type": "company",
        "last_modified": "2018-06-24T22:22:28+01:00",
        "status": "live"
      }
    ]
  }
}'

Clone this wiki locally