Skip to content

Model objects | First class

James Williamson edited this page Jul 6, 2018 · 6 revisions

What is a first class object?

These objects act as entry points when processing a feed. In general, they require at least 4 properties that are used when syncing.

Property Name Required Type Description
external_id True string Used to find the object model within BookingBug
object_type True string For example "company"
last_modified True datetime Used to detemine if an object should be updated
status True string There are 3 possible values. live, disabled, delete

First class objects can contain second class objects which you can read about here. They can also contain other first class objects when there is a One to Many relationships. This relationship exists between Companies and Resources.

external_id Field

This property on an object is used to identify the object within its type in the BookingBug environment. It should be unique with that object type.

last_modified Field

last_modified is used to compare objects in the BookingBug environment and the feed. An object will only be imported if the feed objects last_modified is greater (not equal) than the one in BookingBug.

status Field

status is used to determine what to do with the Object.

Status Description
live Object should exist in BookingBug in an active state
disabled Object should exist in BookingBug but in an inactive state
deleted Object is removed from the BookingBug environmen. Potentially soft deleted

Company

  • First class object
  • Responses to last_modified
  • Has an external reference
  • Many to many relationships with Person
  • One to many relationships with Resources

Company JSON Example

Property Name Required on creation Type Description
object_type True string "company" .
name True string This is used to display the name of a company
created_at False datetime This will be automatically set if not provided
address False Address See second class address object
description False string The description added to the company
timezone False string A timezone in the country/city format
telephone False string Phone number that is stored against the company
currency_code False string A standard currency code. eg GBP
extras False extra property See Extra Properties (Business questions)

Person

  • First class object
  • Responses to last_modified
  • Has an external reference
  • Many to many relationships with Company

Person JSON Example

Property Name Required on creation Type Description
object_type True string "person"
name True string This is used to display the name of a company
description False string The description added to a person
created_at False datetime This will be automatically set if not provided
company_external_ids False Array (string) A list of companies related to the person
email False string An email associated with the person
telephone False string A phone number associated with the person
extras False extra property See Extra Properties (Business questions)

Resource

  • First class object
  • Responses to last_modified
  • Has an external reference
  • Many to One relationship with Company

Resource JSON Example

Property Name Required on creation Type Description
object_type True string "resource"
name True string Name associated with user
description False string The description added to a resource
address False Address See second class address object
telephone False string Telephone assoicated with the resource
created_at False datetime This will be automatically set if not provided

User

  • First class object
  • Responses to last_modified
  • Has an external reference
  • Many to many relationships with Company

User JSON Example

Property Name Required on creation Type Description
object_type True string "user"
name True string Name associated with user
email True string Email associated with user
roles True Array (string) An email associated with the person
company_external_ids True Array (string) A list of companies the user has access to
created_at False datetime This will be automatically set if not provided

Clone this wiki locally