Skip to content

Basic import request

James Williamson edited this page Aug 10, 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 \
<<<<<<< HEAD
  https://bedbathstore.bookingbug.com/api/v1/admin/37000/imports \
  -H 'App-Id: f7caacd6' \
  -H 'App-key: 37a832ad5d61b7575c2890540c55562b' \
  -H 'Auth-Token: KzEWHYq1tgOtcFCU0Y8uvw' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -H 'Postman-Token: 99b50893-b1a1-4854-8601-681fb8d97e43' \
  -d '{
  "meta": {
    "created_at": "2018-06-27T09:40:15+01:00",
    "feed_name": "asushnet"
=======
  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"
>>>>>>> c6acadc1b6d18bbe71ea98e5c275ad208607fa17
  },
  "settings": {
    "version": "0.0.1"
  },
  "data": {
    "companies": [
      {
<<<<<<< HEAD
        "name": "West Lake Country Club",
        "external_id": "34335",
=======
        "name": "The name of a store or Branch",
        "external_id": "an_id",
>>>>>>> c6acadc1b6d18bbe71ea98e5c275ad208607fa17
        "object_type": "company",
        "last_modified": "2018-06-24T22:22:28+01:00",
        "status": "live"
      }
    ]
  }
}'
<<<<<<< HEAD
=======

The above request will return you a response describing what happened during the Import Process. An example is shown below. There is also an Asynchronous version of the endpoint available for long running jobs.

{
    "internal_reference": "ec671f68-ed15-407d-8971-a919efab635d",
    "feed_name": "The corporation",
    "created_at": "2018-06-27T09:40:15+01:00",
    "started_at": "2018-06-27T09:40:17+01:00",
    "completed_at": "2018-06-27T09:40:30+01:00",
    "status": "completed",
    "objects_to_import": 1,
    "objects_imported": 1,
    "objects": [
        {
            "status": "created",
            "object_type": "company",
            "object_external_id": "an_id"
        }
    ]
}
>>>>>>> c6acadc1b6d18bbe71ea98e5c275ad208607fa17

Clone this wiki locally