Skip to content

Model objects | First class

James Williamson edited this page Aug 10, 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 environment. Potentially soft deleted

Company

  • First class object
  • Responses to last_modified
  • Has an external reference

What its purpose?

This object can be used to represent a location within an organisation. Another purpose of a Company is to represent hierarchy.

Relationships with other objects

  • Many to many relationship with People
  • One to many relationship with Resources

Company JSON Example

BookingBug Company Api

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

What its purpose?

This object is used to represent a bookable person within a company such as an employee. They can have a schedule associated with them that powers the booking engine.

Relationships with other objects

  • Many to many relationship with Companies

Person JSON Example

BookingBug People Api

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

What its purpose?

This object is used to represent a bookable object within a company. Such as a room or piece of equipment.

Relationships with other objects

  • Many to One relationship with Companies

Resource JSON Example

BookingBug Resource Api

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 associated 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

What its purpose?

These are users that can be used to login into BookingBug Admin portal. They have a close relationship with companies. Meaning a person can login to a company they are associated with, or a company that sit below that company in the hierarchy.

Relationships with other objects

  • Many to many relationship with Companies
  • One to One relationship with Person (not required)

User JSON Example

BookingBug User Api

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