-
Notifications
You must be signed in to change notification settings - Fork 0
Getting started | What API endpoint?
James Williamson edited this page Jul 6, 2018
·
1 revision
The Importer is a number of endpoints that exist within the Admin Api. Therefore an auth-token is required before using the Importer. To obtain one you must first log in.
Firstly, you must have an Owner login for the Parent company. Once you have a email and password you can login.
curl -X POST \
https://your-company.bookingbug.com/api/v1/login/admin/37000 \
-H 'App-Id: [APP_ID]' \
-H 'App-Key: [APP_KEY]' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-d '{
"email": "importer@your-company.com",
"password": "secretpassword"
}'
The resulting JSON will contain an auth-token
that can be used to sequential requests.
{
"email": "importer@your-company.com",
"auth_token": "GiHkzjlNttNO0mKzEia1cg",
"company_id": 37000,
"path": "https://your-company.bookingbug.com/api/v1",
"role": "owner"
}
Let's imagine we want to import a single person. The below JSON payload could do that. We would have to make sure a company existed in our BookingBug with a valid external_id (also know as api_ref, ref, reference)
{
"meta": {
"created_at": "2018-06-11",
"feed_name": "Name of your feed"
},
"settings": {
"version": "0.0.1"
},
"data": {
"people": [
{
"external_id": "0b74431fd4aac25e136c93c3149ad58f",
"name": "Joe Blogs",
"description": "Vice President",
"object_type": "person",
"company_external_ids": [
"0b74431fd4aac25e136c93c3149ad58f"
],
"created_at": "2018-06-11",
"last_modified": "2018-06-20T14:28:16.922120",
"email": "joeblogs@your-company.kom",
"status": "live",
}
]
}
}
The curl request below shows the request needed to start and Import.
Verb: POST
Endpoint: /api/v1/admin/[COMPANY_ID]/imports
curl -X POST \
https://your-company.bookingbug.com/api/v1/admin/37000/imports \
-H 'App-Id: [APP_ID]' \
-H 'App-Key: [APP_KEY]' \
-H 'Auth-Token: [AUTH_TOKEN]' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-d '[PAYLOAD]'