OnSched Company: Top-down Infrastructure

OnSched uses a top-down infrastructure when referencing a Company. The Company is the highest level, this is usually your business. At the Company Level all Services, Settings, and Notifications created will be accessible within Secondary Locations to be created.

Below the Company level are Locations, a Company may have any number of Secondary Locations within a Company. These Locations could be a physical location (such as one of many storefront locations), or instead could be each of your clients within your Company. Services, Settings, and Notifications created at the Location level will only apply to that given Location.

Within every Secondary Location lives your Resources, a Resource is a person, place, or item, that requires availability to be booked (Such as Salesrep, Room, or Salon Chair).

Using a Multi-Company Approach

In certain use cases, it is best to create multiple Companies in order to better manage your booking flow and organization of data/permissions. For example... If you are a provider for multiple large clients, each of which have many storefront locations, this may be better handled by creating multiple Companies.

The Upside
By separating your clients into individual OnSched Company entities, this will allow you to keep all of the data for each client in their own separate environments.

The Downside
Each OnSched Company entity carries its own set of client credentials to access the API, forcing you to manage multiple sets of API keys for each Company that you create.

Multi-Company Scope

In order to begin creating a multi-company approach to your booking flow, you will first need a Company Scope added to your profile, which will allow new Companies to be created with your OnSched Identity Credentials. This step must be done by an OnSched Admin support staff member, if you wish to begin this process please contact Sales or your Technical Account Manager.

Creating New Companies

In order to create new Companies, you will first connect to the OnSched API using the authentication mechanism described in Authentication. Once a Bearer token is obtained and your Company Scope has been added, you may make a POST request to create a new Company.

curl -X POST 
  'https://sandbox-api.onsched.com/setup/v1/companies'
  --header 'Content-Type: application/json-patch+json' 
  --header 'Accept: application/json' 
  --header 'Authorization: Bearer {AUTH_TOKEN}' 
  -d '{
"name": "My Company",
"addressLine1": "address",
"addressLine2": "address2",
"state": "province",
"postalCode": "zip",
"timezoneName": "America/Toronto",
"city": "Toronto",
"country": "Canada",
"registrationEmail": "[email protected]",
"phone": "9999999999", 
"email": "[email protected]", 
"website": "www.onsched.com",
}
POST /setup/v1/companies HTTP/1.1
Host: sandbox-api.onsched.com
Content-Type: application/json
Authorization: Bearer {AUTH_TOKEN}
Accept: */*
Cache-Control: no-cache
Host: sandbox-api.onsched.com
Accept-Encoding: gzip, deflate
Content-Length: 102
Cookie: ARRAffinity={RANDOM_STRING}
Connection: keep-alive
cache-control: no-cache

{
        "name": "My Company",
        "addressLine1": "address",
        "addressLine2": "address2",
        "state": "province",
        "postalCode": "zip",
        "timezoneName": "tz",
        "city": "city", 
    "country": "Canada",
        "registrationEmail": "[email protected]",
        "phone": "9999999999", 
    "email": "[email protected]", 
    "website": "www.onsched.com",
}
var request = require("request");

var options = { method: 'POST',
  url: 'https://sandbox-api.onsched.com/setup/v1/services',
  headers: 
   { 'cache-control': 'no-cache',
     Connection: 'keep-alive',
     Cookie: 'ARRAffinity={RANDOM_STRING}}',
     'Content-Length': '102',
     'Accept-Encoding': 'gzip, deflate',
     Host: 'sandbox-api.onsched.com',
     'Cache-Control': 'no-cache',
     Accept: '*/*',
     Authorization: 'Bearer {AUTH_TOKEN}',
     'Content-Type': 'application/json' },
  body: 
    {
        "name": "My Company",
        "addressLine1": "address",
        "addressLine2": "address2",
        "state": "province",
        "postalCode": "zip",
        "timezoneName": "tz",
        "city": "city", 
    "country": "Canada",
        "registrationEmail": "[email protected]",
        "phone": "9999999999", 
    "email": "[email protected]", 
    "website": "www.onsched.com",
    },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://sandbox-api.onsched.com/setup/v1/companies",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "Accept": "*/*",
    "Cache-Control": "no-cache",
    "Host": "sandbox-api.onsched.com",
    "Accept-Encoding": "gzip, deflate",
    "Content-Length": "102",
    "Cookie": "ARRAffinity={RANDOM_STRING}",
    "Connection": "keep-alive",
    "cache-control": "no-cache"
  },
  "processData": false,
  "data": "{\n\t\"name\" : \"My Company\", \n\t\"addressLine1\" : \"address\", \n\t\"addressLine2\" : \"address2\", \n\t\"state\" : \"province\", \n\t\"postalCode\" : \"zip\", \n\t\"timezoneName\" : \"tz\", \n\t\"city\" : \"city\",  \n\t\"country\" : \"Canada\", \n\t\"registrationEmail\"  \"[email protected]\", \n\t\"phone\" : \"9999999999\",  \n\t\"email\" : \"[email protected]\",  \n\t\"website\" : \"www.onsched.com\"n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

Did this page help you?