NAV
javascript

HotSchedules IoT Platform for Developers

Restaurant operators need access to data that helps them work more productively and efficiently. Your job is to deliver it. The HotSchedules IoT Platform for Developers can help you deliver work more productively and efficiently through a set of software modules that collect data from virtually any source in real-time and then deliver select data that is relevant, timely and actionable.

Whether you work for a restaurant, a software company or for yourself - wherever you are, whatever you do - IoT Platform gives you the power to innovate faster and cheaper than ever before.

Getting Started

This documentation is intended for the developer wanting to integrate into the HotSchedules IoT (Internet of Things) Platform by:

The IoT Platform calls accounts namespace. A namespace is your secured storage location of HotSchedules’ cloud solution for your business. Your namespace is uniquely named based on your organization name. When you sign up through the HotSchedules IoT Platform Developer Portal, you will be able to create both a namespace and users to access that namespace.

The HotSchedules IoT Platform Developer Portal has an easy sign up process to quickly get started developing your application for the IoT Platform. In just a few short clicks, your IoT platform application development can begin.

IoT Platform APIServer

Overview

The HotSchedules IoT Platform APIServer is a set of secure REST APIs that are used to store your data.

The foundation for this document is the Mongo DB reference located at http://docs.mongodb.org/manual/reference/operator/.

Users may be unfamiliar with the REST query syntax. Those familiar with SQL should note that the same types of SQL query operations are possible using the REST API. Users wishing to understand the mapping between SQL queries (SELECT statements) and the Query syntax - should refer to the following document: http://docs.mongodb.org/manual/reference/sql-comparison/.

Getting Started

To access the HotSchedules IoT Platform Cloud API, you need to login with you user and password which is provided by HotSchedules. The API docs are available at this location: https://api.bodhi.space/apidocs/index.html.

If you enter your credentials (username and password) and click Explore, you will see a list of APIs which you can access for your namespace. The Bodhi Cloud APIs are REST APIs which returns JSON for all responses.

Each API has examples and an opportunity to Try it out!. You can add data using our provided types or create your own type. NOTE: Should you create your own type, the new type will show up in the API Documentation for your namespace.

Logging In to APIDocs

Exploring the APIDocs

Once logged into the APIDocs you can both explore the provided types and their respective restful verbs: GET, PUT, DELETE, PATCH. The APIDocs are much more than API Documentation, it is a powerful interactive tool that allows the developer and/or administrator to create, update, delete data as well as manage the schema for their organization.

Getting started with the HotSchedules IoT Platform REST API

The HotSchedules IoT Platform (Bodhi) REST API allows you to query meta-data about your stores, labor, sales, and HotSchedules Agents running in your stores. You can also do some fancy things like get social information, upload files, send push notifications and emails, and even make payments.

Base URL

All URLs referenced in the documentation have the following base:

https://api.bodhi.space/<organization_name>

The Bodhi REST API is served over HTTPS. To ensure data privacy, unencrypted HTTP is not supported.

Authenticating to the API

HTTP requests to the REST API are protected with HTTP Basic and HTTP Cookie authentication. In short, you will use your HotSchedules IoT Platform account credentials (username and password) for HTTP Basic authentication. If you do not have credentials, you can signup at bodhi.space or directly here https://bodhi.space/signup/

Syntax: curl -ik -u username:password -X GET https://api.bodhi.space/me

For example: curl -ik -u platform:user -X GET https://api.bodhi.space/me

Your results will look like this:
HTTP/1.1 200 OK
Server: nginx/1.8.0
Date: Sat, 21 May 2016 15:22:26 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 456
Connection: keep-alive
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers:
Access-Control-Allow-Methods: *
Access-Control-Allow-Origin: Access-Control-Expose-Headers: WWW-Authenticate, Server-Authorization, Location
Request-Time: 383
Set-Cookie: RUSK=“8a6f98bb1033055fc04d644c0006789335f96c2b-username=platform”; Path=/; Domain=.bodhi.space; Secure; HTTPOnly

{"lastName":"User","sys_created_at":"2016-05-21T15:22:11.157Z","authorizations":[{"namespace":"bodhi-social","read":true}],"profiles":["bodhi-social.user"],"usertype":"person","firstName":"Platform","sys_id":"57407d23b3b82c51e5cb3afb","password":"$2a$12$C/ZJYSZ4qkR5pU5yHQEkLuvcOVjP4rqLdOHlPq4zcDZt9dcYpBeMC","sys_version":1,"email":"customercare@hotschedules.com","username":"platform","sys_type_version":12}

Next, read the Set-Cookie header to get your cookie string:
RUSK="8a6f98bb1033055fc04d644c0006789335f96c2b-username=platform" in the example

Now use the cookie auth to authenticate to the API
curl -ik --cookie "RUSK=8a6f98bb1033055fc04d644c0006789335f96c2b-username=platform" -X GET https://api.bodhi.space/me

Cookie authorization does not expire and can be used to authenticate moving forward.

Once your Organization is setup in the platform (you can signup for free at https://developer.bodhi.space) you can access your data at https://api.bodhi.space/ .

So for example, if your organization name is my-deli, your URL would be https://api.bodhi.space/my-deli

Now that you’ve authenticated to the API, it’s time to look at some data.

Making a call

The HotSchedules REST API supports all the standard REST verbs
GET
POST
PUT
PATCH
DELETE

You can access these verbs for each of the types in the HotSchedules system. When an organization is created in the HotSchedules Platform, the organization automatically gets 32 ‘types’ that will store standard information and data about your organization. Those 'types’ can be viewed and reviewed at https://api.bodhi.space/apidocs/index.html

GET

As an example, let’s do a GET on a store via CURL curl -ik --cookie "RUSK=8a6f98bb1033055fc04d644c0006789335f96c2b-username=platform" -X GET https://api.bodhi.space/bodhi-social/resources/Store

This call will return the information about a store that’s been created for the bodhi-social organization

[{"sys_version":1,"image_url":"https://upload.wikimedia.org/wikipedia/commons/5/54/Golden_Gate_Bridge_0002.jpg","sys_type_version":12,"address":{"street_address":"555 Mission","extended_address":"","locality":"San Francisco","region":"CA","postal_code":"94111","country":"US"},"store_hours":[{"days":[7,1],"start":"0500","end":"0000"},{"days":[1,2],"start":"1200","end":"0200"},{"days":[2,3],"start":"1200","end":"0200"},{"days":[3,4],"start":"1200","end":"0200"},{"days":[4,5],"start":"1200","end":"0200"},{"days":[5,6],"start":"1200","end":"0200"},{"days":[6,7],"start":"0500","end":"0000"}],"sys_created_by":"admin__bodhi-social","sys_created_at":"2016-05-21T15:37:15.560Z","name":"platformstore","store_number":"1","display_name":"Platform Store","sys_id":"574080abb9a19e2dadee775b"}]

You can also get the JSON payload by navigating directly to this URL https://api.bodhi.space/bodhi-social/resources/Store

You can create your own store for your organization either by executing a POST command (see below) to https://api.bodhi.space/<organization_name>/resources/Store or using our free store manager tool at https://bodhi.space/store-manager . Either way, a store is a critical anchor for information in the Platform.

Next let’s look up a sale for our store in bodhi-social

curl -ik --cookie "RUSK=8a6f98bb1033055fc04d644c0006789335f96c2b-username=platform" -X GET https://api.bodhi.space/bodhi-social/resources/SalesTransaction

RESULT:

[{"order_number":10184,"item_count":1,"store_id":"574080abb9a19e2dadee775b","employee":{"id":"5151","name":"Ted Morrison"},"business_day":"2016-05-20","revenue_center":{"id":"2","name":"Restaraunt"},"type":{"id":"4","name":"1"},"timestamp":"2016-05-21T03:34:00.000Z","transaction_id":"557605fc4c32e071180a46042016-05-2010184","net_total":{"value":325,"code":"USD","scale":2},"discount_total":{"value":0,"code":"USD","scale":2},"tax_total":{"value":23,"code":"USD","scale":2},"gross_total":{"value":348,"code":"USD","scale":2},"tender_total":{"value":348,"code":"USD","scale":2},"order_opened_at":"2016-05-21T03:33:00.000Z","order_closed_at":"2016-05-21T03:34:00.000Z","guest_count":1,"sys_version":1,"sys_created_at":"2016-05-21T16:02:30.800Z","sys_created_by":"admin__bodhi-social","sys_type_version":12,"sys_id":"574086965eacd06aa3db036b"}]

We can also look up our Store using query parameters in our URL

curl -ik --cookie "RUSK=8a6f98bb1033055fc04d644c0006789335f96c2b-username=platform" -X GET 'https://api.bodhi.space/bodhi-social/resources/SalesTransaction' --data-urlencode 'where={"business_day":"2016-05-20"}'

RESULT:
[{"order_number":10184,"item_count":1,"store_id":"574080abb9a19e2dadee775b","employee":{"id":"5151","name":"Ted Morrison"},"business_day":"2016-05-20","revenue_center":{"id":"2","name":"Restaraunt"},"type":{"id":"4","name":"1"},"timestamp":"2016-05-21T03:34:00.000Z","transaction_id":"557605fc4c32e071180a46042016-05-2010184","net_total":{"value":325,"code":"USD","scale":2},"discount_total":{"value":0,"code":"USD","scale":2},"tax_total":{"value":23,"code":"USD","scale":2},"gross_total":{"value":348,"code":"USD","scale":2},"tender_total":{"value":348,"code":"USD","scale":2},"order_opened_at":"2016-05-21T03:33:00.000Z","order_closed_at":"2016-05-21T03:34:00.000Z","guest_count":1,"sys_version":1,"sys_created_at":"2016-05-21T16:02:30.800Z","sys_created_by":"admin__bodhi-social","sys_type_version":12,"sys_id":"574086965eacd06aa3db036b"}]

So https://api.bodhi.space/bodhi-social/resources/SalesTransaction?where={%27business_day%27:%272016-05-20%27} would return all SalesTransaction’s for the business day of 2016-05-20. The URL https://api.bodhi.space/bodhi-social/resources/SalesTransaction?where={%27store_id%27:%27574080abb9a19e2dadee775b%27} would return all SalesTransaction’s for the store 574080abb9a19e2dadee775b (our Platform test store).

All Types can be queried by any parameter within the type using a ?where={} clause. It’s EXTREMELY important for efficiency and performance to query using indexes on your types. You can review the Types for your organization as well as the Indexes and Parameters by using our free Type Tool located at https://tools.bodhi.space/types or by inspecting https://api.bodhi.space/<organization_name>/resources/BodhiType

POST

To POST to a type you need to add the the header: 'Content-Type: application/json’ to your cURL Command

curl -ik -H 'Content-Type: application/json' --cookie "RUSK=8a6f98bb1033055fc04d644c0006789335f96c2b-username=foo" -X POST -d '{ "store_id": "l8zeL", "business_day": "2016-05-13", "timestamp": "2016-05-12T05:58:31.296Z", "transaction_id": "FGHG012", "tender_total": { "code": "USD", "scale": 2, "value": 620 } }' https://api.bodhi.space/<organization_name>/resources/SalesTransaction

That command will post the json object to the SalesTransaction type. You can now GET on this type either using cURL or the free query tools available at https://tools.bodhi.space/query

Bulk Post

All bulk operations are accessible through https://api.bodhi.space
The size limitation for the body is 17MB

Syntax:

POST /<organization_name>/bulk with json body
{ "config": { "op": "insert" or "update" or "upsert" or "invite", * see below "report": true, <- optional, need a report? (default false) "target": "target_name” <- the name of the type (not for invite) }, "payload": [{ "the_field": "my first thing to insert or upsert or invite", "other_field": "the_other_field" }, { "the_field": "my second thing to insert or upsert", "other_field": "the_other_field2" }] }

The payload varies depending on the type of operation and Returns 202 with header bulk_id:<the bulk id>

The result of a report, if requested, is accessible as soon as the processing is done on:

GET /<organization_name>/bulk/<bulk_id>

RESPONSE:
returns 200 with a json array body where the order of the cells matches the order of the payload. The report can be accessed only once.
returns 204 if the report is not ready yet
returns 404 if no report was found with that id

Example:

{ "config": { "op": "insert", "report": true, "target": "BulkTest" }, "payload": [{ "name": "leo", "other_field": "mauris non" }, { "name": "orci", "other_field": "sit amet justo" }, { "name": "nulla", "other_field": "pulvinar sed nisl nunc rhoncus" }, { "name": "nulla", "other_field": "diam cras" }, { "name": "est", "other_field": "dui nec nisi volutpat" }, { "name": "lorem", "other_field": "cursus id" }, { "name": "molestie", "other_field": "potenti nullam porttitor lacus at" }, { "name": "sapien", "other_field": "ultrices aliquet maecenas leo" }, { "name": "nibh", "other_field": "consectetuer eget rutrum at" }, { "name": "luctus", "other_field": "nisl nunc" }] }

PUT

The HTTP verb PUT can be used on any type as long as there’s a unique index on the field or fields. You can always PUT on sys_id

As an example, in the above SalesTransaction example, the sys_id is 574086965eacd06aa3db036b, a PUT to the SalesTransaction based on sys_id would be as follows:

curl -ik -H 'Content-Type: application/json' --cookie "RUSK=8a6f98bb1033055fc04d644c0006789335f96c2b-username=foo" -X PUT -d '{ "store_id": "l8zeL", "business_day": "2016-05-13", "timestamp": "2016-05-12T05:58:31.296Z", "transaction_id": "FGHG012", "tender_total": { "code": "USD", "scale": 2, "value": 620 } }' https://api.bodhi.space/tutorial/resources/SalesTransaction/574086965eacd06aa3db036b

PUT Upsert

Upsert is a safe way to replace an existing record, or POST a record if the entry does not currently exist.

You can upsert by appending your URL with ?upsert=true

As an example, the above PUT example can be changed to a replace by appending the ?upsert=true to the cURL command:

curl -ik -H 'Content-Type: application/json' --cookie "RUSK=8a6f98bb1033055fc04d644c0006789335f96c2b-username=foo" -X PUT -d '{ "store_id": "l8zeL", "business_day": "2016-05-13", "timestamp": "2016-05-12T05:58:31.296Z", "transaction_id": "FGHG012", "tender_total": { "code": "USD", "scale": 2, "value": 620 } }' https://api.bodhi.space/tutorial/resources/SalesTransaction/574086965eacd06aa3db036b?upsert=true

PATCH

the HTTP verb PATCH will allow you to alter single parameters or fields within a record in your type. Patch commands follow the following sytax: [ { “op”: “replace”, “path”: “/baz”, “value”: “boo” }, { “op”: “add”, “path”: “/hello”, “value”: [“world”] }, { “op”: “remove”, “path”: “/foo”} ]

The HTTP verb PATCH can be used on any type as long as there’s a unique index on the field or fields. You can always PATCH on sys_id

DELETE

the HTTP verb DELETE will allow you to remove a record in your type. DELETE commands follow the following sytax:

To delete multiple records, include a ?where={} in your URL to narrow or expand then number of records removed.

File Upload

The Platform BodhiFileUpload endpoints are special types that allow a user to upload and download any file (like a dbf file from your store’s POS).

Metadata of your file is posted to type BodhiFileUpload on successful upload

BodhiFileUpload example record:
{ "namespace": "bodhi", "original_name": "profile_pic5.jpg", "sys_version": 1, "location": "bodhi/profile_pic5.jpg", "uploaded_at": "2015-09-10T19:42:48+0000", "sys_created_by": "admin__bodhi", "sys_created_at": "2015-09-10T19:42:49+0000", "name": "profile_pic5.jpg", "media_type": "image/jpeg", "sys_id": "55f1dd39b9b5904f64c8212f" }

Examples:
The following are curl examples of how to specify file location in your upload/download/delete commands. Everything after “upload/” or “download/” in the url is used as the destination. Note that filename is always specified in the url.

curl -X POST -u <username>:<password> https://api.bodhi.space/<organization_name>/controllers/vertx/upload/recipes/food/BurritoRecipe.txt -F "upload1=@THE_FILE"

curl -X PUT -u <username>:<password> https://api.bodhi.space/<organization_name>/controllers/vertx/upload/recipes/food/BurritoRecipe.txt -F "upload1=@THE_FILE"

Download by path:
curl -X GET -u <username>:<password> https://api.bodhi.space/<organization_name>/controllers/vertx/download/recipes/food/BurritoRecipe.txt

Download by sys_id:
curl -X GET -u <username>:<password> https://api.bodhi.space/<organization_name>/controllers/vertx/download/56f9c2b4fa92ec27934a76ae

Delete a file:
curl -X DELETE -u <username>:<password> https://api.bodhi.space/<organization_name>/controllers/vertx/upload/recipes/food/BurritoRecipe.txt

Working with Labor data

Storing and accessing labor data is a critical function of the HotSchedule IoT Platform. To access your labor data, you will use the following types:

Steps to create new data:

  1. Create a Store
  2. Create a StoreJob
  3. Create a Employee
  4. Create EmployeePosition using the Employee, Store, and StoreJob data
    • Patch Store.employee_ids with the new employee’s sys_id
    • Patch Employee.positions with the new EmployeePosition
  5. Create Timecard using EmployeePosition data

How does the data map together?

EmployeePosition is a reference table for looking up stores, employees, jobs, and pay rates. Ideally, this should be the first place you look for information when querying labor data.

A Store has many employees (Array of sys_ids) – Store.employee_ids maps to each Employee.sys_id

– Example Query: Return all stores that the specified employee is associated with
https://api.bodhi.space/<organization_name>/Store?where={'employee_ids':'<EMPLOYEE_ID>'}

A Store has many jobs – Store.sys_id maps to StoreJob.store_id

– Example Query: Return all jobs at a specified store
https://api.bodhi.space/<organization_name>/StoreJob?where={'store_id':'<STORE_ID>'}

An Employee has many positions (Array of EmployeePosition)

Example Queries:

Return all positions for a specified employee across all stores
https://api.bodhi.space/<organization_name>/EmployeePosition?where={'employee_id':'<EMPLOYEE_ID>'}

https://api.bodhi.space/<organization_name>/EmployeePosition?where={'employee_reference.name':'<EMPLOYEE_NAME>'}

https://api.bodhi.space/<organization_name>/EmployeePosition?where={'employee_reference.id':'<EMPLOYEE_EXTERNAL_ID>'}

Return all positions at a specified store across all employees and jobs.
(NOTE: May include duplicates if employees have multiple positions at the same store)
https://api.bodhi.space/<organization_name>/EmployeePosition?where={'store_id':'<STORE_ID>'}

https://api.bodhi.space/<organization_name>/EmployeePosition?where={'store_reference.name':'<STORE_NAME>'}

https://api.bodhi.space/<organization_name>/EmployeePosition?where={'store_reference.id':'<STORE_NUMBER>'}

Return all employees with a specified job across all stores https://api.bodhi.space/<organization_name>/EmployeePosition?where={'job_id':'<JOB_ID>'}

https://api.bodhi.space/<organization_name>/EmployeePosition?where={'job_reference.name':'<JOB_NAME>'}

https://api.bodhi.space/<organization_name>/EmployeePosition?where={'job_reference.id':'<JOB_EXTERNAL_ID>'}

An Employee has many Stores through EmployeePosition

– Example Query: Return an array of Store.sys_id that the employee works at https://api.bodhi.space/<organization_name>/EmployeePosition?where={'employee_id':'<EMPLOYEE_ID>'}&fields=store_id

An Employee has many StoreJobs through EmployeePosition

– Example Query: Return an array of StoreJob.sys_id for the specified employee
https://api.bodhi.space/<organization_name>/EmployeePosition?where={'employee_id':'<EMPLOYEE_ID>'}&fields=job_id

(Same as the two previous examples)

An Employee has many Timecards * Employee.sys_id maps to Timecard.employee_id * Employee.external_ids maps to Timecard.employee_reference.id * Employee.name.family_name maps to Timecard.employee_reference.name

– Example Query: Return all timecards for a specified employee
https://api.bodhi.space/<organization_name>/Timecard?where={'employee_id': '<EMPLOYEE_ID>'}

A Store has many Timecards

– Example Query:Return all timecards for all employees at a specified store
https://api.bodhi.space/<organization_name>/Timecard?where={'store_id': '<STORE_ID>'}

A StoreJob has many Timecards

– Example Query:Return all timecards for all employees with the specified job across all stores
https://api.bodhi.space/<organization_name>/Timecard?where={'job_id': '<JOB_ID>'}

– Example Query:Return all timecards for all employees with the specified job at a specified store
https://api.bodhi.space/<organization_name>/Timecard?where={'job_id': '<JOB_ID>', 'store_id': '<STORE_ID>'}

Employee payment rates: Base payment rates for a position are defined in the StoreJob type. When an EmployeePosition is created, the regular, overtime, and double time rates are copied from the StoreJob and adjusted for that employee. This allows for multiple employees to have the same job, but different payment rates.

Working with Sales data

Storing and accessing Sales data is a critical function of the HotSchedule IoT Platform. To access your sales data, you will use the following types:

Steps to create new data:

  1. Create a Store
  2. Create a SalesTransaction
  3. Create a SalesItem

How does the data map together?

SalesTransaction is a reference table for looking up items sold and the meta data about those items as they refer to a specific order on a specific business day. Ideally, this should be the first place you look for information when querying Sales data.

A Store has many SalesTransactions
– SalesTransaction.store_id maps to Store.sys_id

– Example Query: Return all SalesTransactions for a store
https://api.bodhi.space/<organization_name>/SalesTransaction?where={'store_id':'<store.sys_id>'}

– Example Query: Return all the sums of all SalesTransactions for per store for a day https://api.bodhi.space/<organization_name>/resources/SalesTransaction/aggregate?pipeline=[ { $match:{'business_day':'2016-06-24'} }, { $group: { _id: '$store_id', total: { $sum: '$net_total.value' } } } ]

A Store has many SalesItem
– SalesItem.store_id maps to Store.sys_id

– Example Query: Return all SalesItem for a store
https://api.bodhi.space/<organization_name>/SalesItem?where={'store_id':'<store.sys_id>'}

A Store has many entries in SalesCategory
– SalesCategory.store_id maps to Store.sys_id

– Example Query: Return all SalesCategories for a store
https://api.bodhi.space/<organization_name>/SalesCategory?where={'store_id':'<store.sys_id>'}

A Store has many RevenueCenters
– RevenueCenter.store_id maps to Store.sys_id

– Example Query: Return all RevenueCenters for a store
https://api.bodhi.space/<organization_name>/RevenueCenter?where={'store_id':'<store.sys_id>'}

A SalesTransaction has many SalesItems
– SalesTransaction.transaction_id maps to SalesItem.transaction_id

– Example Query: Return all SalesItems for a SalesTransaction
https://api.bodhi.space/<organization_name>/SalesTransaction?where={'transaction_id':'<SalesTransaction.transaction_id>'}

A SalesTransaction has a RevenueCenter
– SalesTransaction.revenue_center.id maps to RevenueCenter.instore_id
– SalesTransaction.revenue_center.name maps to RevenueCenter.display_name

– Example Query: Return all SalesTransactions for a RevenueCenter https://api.bodhi.space/<organization_name>/SalesTransaction?where={'revenue_center.id':'<RevenueCenter.instore_id>'}

A SalesTransaction has an Employee
– SalesTransaction.employee.id maps to Employee.external_ids.key
– SalesTransaction.employee.name maps to Employee.name.formatted_name

– Example Query: Return all SalesTransaction for an Employee https://api.bodhi.space/<organization_name>/SalesItems?where={'employee.id':'<Employee.external_ids.key>'}

A SalesTransaction AND SalesItem have a day of business
– Example Query: Return all SalesTransactions for business day 05/21/2016 https://api.bodhi.space/<organization_name>/SalesTransaction?where={'business_day':'2016-05-21'}

– Example Query: Return all SalesItems for business day 05/21/2016 https://api.bodhi.space/<organization_name>/SalesItems?where={'business_day':'2016-05-21'}

A SalesItem has a SalesCategory
– SalesItem.sales_category.id maps to SalesCategory.instore_id
– SalesItem.sales_category.name maps to SalesCategory.display_name

– Example Query: Return all SalesItems for a SalesCategory https://api.bodhi.space/<organization_name>/SalesItems?where={'sales_category.id':'<SalesCategory.instore_id>'}

Working with HotSchedules data

The HotSchedules REST API provides a user-friendly way to obtain HS Data.

Examples

Please ensure that API access has been enabled for your HotSchedules account. Contact customer service 1-866-753-3853 for access or questions.

The url path can look like any of the following, depending on which type is being queried:
../hotschedules/<concept_id>/<store_id>/<type_method>?

example:
../hotschedules/1/1/getDriversByInterval?..

../hotschedules/<concept_id>/<type_method>

example:
../hotschedules/1/getStores?..

../hotschedules/<type_method>

example:
../hotschedules/getConcept?..

Getting Data (Examples)

Note: Results are currently cached with a TTL of 60 minutes.

getConcept

curl -X GET -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/getConcept"

getDriversByInterval

curl -X GET -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/getDriversByInterval?start_day=30&start_month=4&start_year=2016&end_day=5&end_month=5&end_year=2016&volume_type=TABLE&data_type=ACTUAL"

getEmpAvailability

curl -X GET -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/getEmpAvailability?active_only=true"

getEmpInfo

curl -X GET -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/getEmpInfo?active_only=true"

getEmpJobs

curl -X GET -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/getEmpJobs?active_only=true"

getGroups

curl -X GET -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/getGroups"

getGuestCounts

curl -X GET -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/getGuestCounts?start_date=2016-04-30T00:00:00&end_date=2016-05-03T00:00:00"

getLaborByBusDay

curl -X GET -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/getLaborByBusDay?start_day=30&start_month=1&start_year=2016&end_day=5&end_month=5&end_year=2016&labor_type=optimal"

getLaborByJobAndInterval

curl -X GET -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/getLaborByJobAndInterval?start_day=30&start_month=1&start_year=2016&end_day=5&end_month=5&end_year=2016&labor_type=optimal"

getProjectedSalesV3

curl -X GET -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/getProjectedSalesV3?start_day=30&start_month=4&start_year=2016&end_day=5&end_month=5&end_year=2016"

getRCVs

curl -X GET -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/getRCVs"

getSalesCats

curl -X GET -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/getSalesCats"

getScheduleV3

curl -X GET -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/getScheduleV3?start_day=30&start_month=4&start_year=2016&end_day=5&end_month=5&end_year=2016"

Example Results

[{"outDate": { "month": 5, "year": 2016, "day": 2 }, "jobHsId": 1111111, "payRate": 1, "inDate": { "month": 5, "year": 2016, "day": 2 }, "specialPay": 0, "empHSId": 222222, "ovtMinutes": 0, "inTime": { "hours": 9, "seconds": 0, "militaryTime": true, "minutes": 0 } ]

getShiftsV3

curl -X GET -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/getShiftsV3?start_day=30&start_month=4&start_year=2016&end_day=5&end_month=5&end_year=2016"

getStoreEmployees

curl -X GET -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/getStoreEmployees?active_only=true"

getStoreJobs

curl -X GET -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/getStoreJobs"

getStores

curl -X GET -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/getStores?group_id=0"

getTimeCards

curl -X GET -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/getTimeCards?start_day=30&start_month=4&start_year=2016&end_day=5&end_month=5&end_year=2016"

getVolumeCounts

curl -X GET -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/getVolumeCounts?start_date=2015-04-30T00:00:00&end_date=2016-05-03T00:00:00&volume_type=TABLE"

Writing Data (Examples)

setTimeCardsV3

curl -X PUT -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/setTimeCardsV3?start_day=30&start_month=4&start_year=2016&end_day=5&end_month=5&end_year=2016" -d "[{ \"jobName\": \"Cook\", \"ovtTtl\": 0, \"ovtHrs\": 0, \"clockOut\": \"2016-07-31T22:05:00-05:00\", \"regWage\": 9, \"clockIn\": \"2016-07-30T15:56:00-05:00\", \"ovtWage\": 13.5, \"breakMinutes\": 0, \"jobId\": 16921407, \"businessDate\": { \"month\": 7, \"year\": 2016, \"day\": 31 }, \"regHrs\": 6.15, \"spcTtl\": 0, \"hsId\": 929931334634, \"spcHrs\": 0, \"ovtMins\": 0, \"storeNum\": 1, \"empPosId\": 1052, \"regTtl\": 55.35 }]"

setEmpJobs

curl -X PUT -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/setEmpJobs?start_day=30&start_month=4&start_year=2016&end_day=5&end_month=5&end_year=2016" -d "[{json_object_1}, {json_object_2}, {json_object_3}...]"

setEmps

curl -X PUT -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/setEmps?start_day=30&start_month=4&start_year=2016&end_day=5&end_month=5&end_year=2016" -d "[{json_object_1}, {json_object_2}, {json_object_3}...]"

setForecastDriversV2

curl -X PUT -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/setForecastDriversV2?start_day=30&start_month=4&start_year=2016" -d "[{json_object_1}, {json_object_2}, {json_object_3}...]"

setGuestCounts

curl -X PUT -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/setGuestCounts?start_day=30&start_month=4&start_year=2016&end_day=5&end_month=5&end_year=2016" -d "[{json_object_1}, {json_object_2}, {json_object_3}...]"

setRVC

curl -X PUT -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/setRVC?group=1&rvcId=1&rvcName=1&isGroupLevel=true" -d "[{json_object_1}, {json_object_2}, {json_object_3}...]"

setSalesCat

curl -X PUT -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/setSalesCat?group=1&salesCatId=1&salesCatName=1&isGroupLevel=true" -d "[{json_object_1}, {json_object_2}, {json_object_3}...]"

setSalesItemsV4

curl -X PUT -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/setSalesItemsV4?start_day=30&start_month=4&start_year=2016&end_day=5&end_month=5&end_year=2016" -d "[{json_object_1}, {json_object_2}, {json_object_3}...]"

setTimeCardsDeclaredTips

curl -X PUT -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/setTimeCardsDeclaredTips?start_day=30&start_month=4&start_year=2016&end_day=5&end_month=5&end_year=2016" -d "[{json_object_1}, {json_object_2}, {json_object_3}...]"

setVolumeCountsV2

curl -X PUT -H "Content-Type:application/json" -u <username>:<password> "https://api.bodhi.space/<namespace>/controllers/vertx/hotschedules/1/1/setVolumeCountsV2" -d "[{json_object_1}, {json_object_2}, {json_object_3}...]"

Working with Macromatix Data

MX RDS API

The mxrds api provides a RESTful way to access data stored in Macromatix RDS database

Access Control

A Bearer Token is required to make calls to the service, ask the team to generate one for you

Store endpoints

Returns store information as well as store roster

Get all stores

GET https://api.mxrds.io/<namespace>/stores ie. curl -H 'Authorization:Bearer <admin-token>' https://api.mxrds.io/<namespace>/stores

Get store by store id

GET https://api.mxrds.io/<namespace>/stores/<store-id> ie. curl -H 'Authorization:Bearer <admin-token>' https://api.mxrds.io/<namespace>/stores/<store-id>

Get store roster

GET https://api.mxrds.io/<namespace>/stores/<store-id>/roster ie. curl -H 'Authorization:Bearer <admin-token>' https://api.mxrds.io/<namespace>/stores/<store-id>/roster

Employee endpoints

Returns employee information

Get all employees

GET https://api.mxrds.io/<namespace>/employees ie. curl -H 'Authorization:Bearer <admin-token>' https://api.mxrds.io/<namespace>/employees

Get employee by employee id

GET https://api.mxrds.io/<namespace>/employees/<employee-id> ie. curl -H 'Authorization:Bearer <admin-token>' https://api.mxrds.io/<namespace>/employees

Calendar endpoints

Returns the fiscal calendar

Get fiscal calendar by year

GET https://api.mxrds.io/<namespace>/calendar/<year> ie. curl -H 'Authorization:Bearer <admin-token>' https://api.mxrds.io/<namespace>/calendar/<year>

Resources endpoints

Returns resources filtered by store id and date of business

Get resource by store id and date of business

Store is required, DOB will use the current day if not specified

GET https://api.mxrds.io/<namespace>/resources/<resource>?store=<store-id>&dob=<yyyy-mm-dd>

List of resources

/inventorywaste
/inventorytransfer
/inventorycount
/forecast
/salesitemforecast
/inventoryforecast
/roster
/salestransaction
/salesitem
/salestransactiondiscount
/transactiontender
/salesitemvoid
/depletion
/schedule
/timecards
/paidinpaidout
/settlement
/storesettlementdetails
/inventorypurchasereturnline
/inventorypurchasereturn
/transactioncontrolinformation
/Inventorypurchaseorder
/inventorypurchaseorderline

Admin endpoints

These endpoints can only be accessed by the mxrds api admin, they are meant to add or update customer configurations

New user config

POST https://api.mxrds.io/<namespace>/settings ie. curl -X POST -H 'Content-Type:application/json' -H 'Authorization:Bearer <admin-token>' https://api.mxrds.io/<namespace>/settings -d '{"token":"<bearer-token>","host":"<rds-host>","port":<rds-port>,"database":"<database>"}'

#response

Code 201

Update existing config

PUT https://api.mxrds.io/<namespace>/settings ie. curl -X PUT -H 'Content-Type:application/json' -H 'Authorization:Bearer <admin-token>' https://api.mxrds.io/<namespace>/settings -d '{"token":"<bearer-token>","host":"<rds-host>","port":<rds-port>,"database":"<database>"}'

#response

Code 204

Get existing config

GET https://api.mxrds.io/<namespace>/settings ie. curl -H 'Authorization:Bearer <admin-token>' https://api.mxrds.io/<namespace>/settings

#response

Code 200 { token: <token>, host: <host>, port: <port>, database: <database> }

Public endpoints

The following endpoints are the only ones that do not require bearer token authorization

Healthcheck

GET https://api.mxrds.io/ ie. curl https://api.mxrds.io/

#response

Code 200 Response { ping: true }

App Info

Returns the name and version of the app GET https://api.mxrds.io/info ie. curl https://api.mxrds.io/info

#response

Code 200 Response { "name":"<app-name>", "version":"<version>" }

Facts

Returns the system and environment information GET https://api.mxrds.io/facts ie. curl https://api.mxrds.io/facts

#response

Code 200 Response ie. { "os": "Linux", "isWindows": false, "isMac": false, "isLinux": true, "isBSD": false, "isSolaris": false, "platform": "linux/4.4.8-20.46.amzn1.x86_64", "title": "rds-api", "pid": 16849, "hostname": "ip-172-31-10-180", "arch": "x64", "cpu": "Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz", "speed": 1795, "cores": 1, "ram": 605.948, "cwd": "/var/app/current", "main": "/var/app/current/index.js", "paths": ["/var/app/current/node_modules", "/var/app/node_modules", "/var/node_modules", "/node_modules"], "process": "node/v4.4.3", "node_env": "not-set", "startedAt": "2016-06-14T23:02:19.021Z" }

getSalesItem

Request

curl -H '<bearer_toke>' https://api.mxrds.io/walmart/resources/salesitem?store=1&dob=2016-06-24

Response

[{ "storeid": "1", "businessday": "2016-06-24T00:00:00.000Z", "itemcode": "Undefined", "description": "All undefined sales items", "postransactionid": "1221", "registernumber": 4, "clerkkey": "3141414", "clerkname": "Brandon", "clerkid": null, "amount": "0.0000", "quantity": 1, "tax": "0.0000", "salescost": "0.0000" }, { "storeid": "1", "businessday": "2016-06-24T00:00:00.000Z", "itemcode": "52791", "description": "Green Bns Sm", "postransactionid": "01011991", "registernumber": 4, "clerkkey": "28928", "clerkname": "Brandon", "clerkid": null, "amount": "0.0000", "quantity": 1, "tax": "0.0000", "salescost": "0.1129" }]

getSalesItemForecast

Request

curl -H 'Authorization:Bearer eyJhbGciOiJIUzI1NiJ9.cmRzLWFwaS1rZmNsdmw.AMtNZJfooodidisise6QbpxyBHytmU7RQqhZQD4nVO_Y' "https://api.mxrds.io/walmart/resources/salesitemforecast?store=1&dob=2016-06-24"

Response

[{ "description": "All undefined sales items", "itemcode": "Undefined", "intervalstart": "2016-06-24T10:30:00.000Z", "storeid": "23232", "businessday": "2016-06-24T00:00:00.000Z", "raw_forecast": 2, "system_forecast": 2, "user_forecast": 2 }, { "description": "Or foo", "itemcode": "232323", "intervalstart": "2016-06-24T10:30:00.000Z", "storeid": "23233", "businessday": "2016-06-24T00:00:00.000Z", "raw_forecast": 0.6, "system_forecast": 1, "user_forecast": 1 }, { "description": "Or stuff", "itemcode": "12121", "intervalstart": "2016-06-24T10:30:00.000Z", "storeid": "179", "businessday": "2016-06-24T00:00:00.000Z", "raw_forecast": 0.6, "system_forecast": 1, "user_forecast": 1 }]

Working with Social data

The HotSchedules REST API provides a user-friendly way to obtain Social data from GooglePlaces,Yelp, and WUnderground.

If “refresh=true” query option is specified - cache will be invalidated and refreshed.

If “proxy=true” query option is specified - no cache will be used at all and requests will be forwarded directly to the endpoint.

API endpoint

https://api.bodhi.space/bodhi-social/controllers/vertx/cacheserver?where=<query_json>

Yelp Data

Yelp query format

By term and location:
{ "term":<search term, for instance KFC, McDonalds etc> - mandatory field "location":<location, for instance Emeryville> - mandatory field "limit":<number of results to return (default:10) - optional field "radius":<search radius in meters> (default:100) - optional field }

By phone:
{ "phone":<phone number in full format> (for example +15555555555) }

Yelp query example:

By term and location:
https://api.bodhi.space/bodhi-social/controllers/vertx/cacheserver/yelp?where={"term":"KFC","location":"Emeryville","limit":3}

By phone:
https://api.bodhi.space/bodhi-social/controllers/vertx/cacheserver/yelp?where={"phone":"+15555555555"}

Wunderground Data

Wunderground query format:

{"query":<query_in_wunderground format>}

More details about WU queries could be found here: http://www.wunderground.com/weather/api/d/docs?d=data/index

Wunderground query example:

https://api.bodhi.space/bodhi-social/controllers/vertx/cacheserver/wu?where={"query":"conditions/q/CA/San_Francisco.json"}

GooglePlaces data

Google Places query example

https://api.bodhi.space/bodhi-social/controllers/vertx/cacheserver/googleplaces?where={"query":"Empire state building"}

Agent

Overview

The Agent provides a single integration point that enables in-store and near-store data collection.

The Platform provides real time bi-directional connections between the cloud and POS via existing Macromatix Livelink and HotSchedules Connect integrations, as well as an an in-store appliance and software agent.

The IoT Platform is built on open standards and integrates with:

Getting Started

HotSchedule IoT Platform Agent provides a single integration point that enables in-store and near-store data collection. HotSchedules IoT Platform Agent is allowed you to integrate with in store data above store data and near store data.

alt text
figure 2

Environment Setup

Installation

The agent cli is installed via a platform specific installer or via node package manager (NPM). The cli prefers to be installed globally.

$> npm install -g agent-cli

General Usage

The general structure of the a command is as follows:

$> npm install agent-cli [options] <action> [arguments]

Options

Options are prefixed with - or -- to separate them from arguments. Each action defines the options it uses, but the options are consistent in naming and usage across the commands.

Common Options

long short arg description
–help none none print help about the command
–verbose -v none print more detailed output
–quiet -q none print essential output
–config -f path specifies the agent’s configuration file
–home -h path specifies the agent’s working directory
–force -F none directive to override safety logic

Arguments

The cli interprets the first argument (non-option) as the action. All subseuqent arguements are command specific.

Each action is described below

Informational Commands

help

The command line provides built in helper functions.

For a descriptive list of the commands

$> npm install agent-cli --help

Action Specific Help

Action specific help can be requested using the following structure.

$> npm install agent-cli <action> --help

version

Print version information.

$> agent-cli --version 
$> agent-cli -V

The output is a simple version identifier following the semantic versioning rules of major, minor, and build.

vM.m.b

info

CLI splash screen for the agent.

$> agent-cli info

Lifecycle Commands

Lifecycle commands allow an administrator to change and check the run state of an agent.

start

Attempts to start an agent.

$> agent-cli start [options] 

Options

long short arg deacription
–verbose -v none print more detailed output
–quiet -q none print essential output
–config -f path specifies the agent’s configuration file
–home -h path specifies the agent’s working directory

status

Provides status about a running agent.

$> agent-cli status [options] 

Options

long short arg deacription
–verbose -v none print more detailed output
–quiet -q none print essential output
–config -f path specifies the agent’s configuration file

stop

Gracefully shutdown the agent.

$> agent-cli stop [options] 

Options

long short arg deacription
–verbose -v none print more detailed output
–quiet -q none print essential output
–config -f path specifies the agent’s configuration file

Diagnostic Commands

Diagnostic commands are used by an admin to troubleshoot an agent having trouble entering a running state or to test environmental specific details uniformly across platforms.

check-core

Used to check the version of agent-core being used and where that file is located on the file system.

$> agent-cli check-core [options]

Options

long short arg deacription
–config -f path specifies the agent’s configuration file

check-config

Used to check for configuration problems in the agent. The agent will load and process all configuration files, but will not enter into a ready state. This command is safe to run even if there is a currently running agent.

$> agent-cli check-cofig [options]

Options

long short arg deacription
–config -f path specifies the agent’s configuration file

check-connection

Used to check for configuration problems in the agent.

$> agent-cli check-connection [options]

Options

long short arg deacription
–config -f path specifies the agent’s configuration file

The provided URL will go through the following checks:

  1. Check the URL format
  2. Check the DNS resolution from the agent’s host
  3. Check the TCP port is reachable by opening up a connection on host:port
  4. Issue a HTTP GET against the ping endpoint of the system

check-route

Used to check for network problems (firewalls & proxy rules) from the perspective of the agent runtime.

$> agent-cli check-route <scheme://host:port/path>

The provided URL will go through the following checks:

  1. Parse
  2. DNS resolve of host/IP
  3. TCP port reachable by opening up a connection on host:port
  4. If scheme is http of https then issue a HTTP GET against the specified URL

How To

Installing Bodhi Agent

Agent Installer and Registration User Guide

Welcome to the User Guide for Installing and registering the Bodhi agent

System Requirements for computer OS: Windows XP SP3, Windows 7, Windows 8.1
Memory: 2GB or more
Disk Space: 10 GB

System requirements for Mobile iOS 7.x, 8.x
Android 4.x
Windows Phone

Step 1: Download Bodhi Installer and the Bodhi Mobile Application

Go developer.bodhi.space to get the correct installer for your system

alt text

NOTE: if the system you are using to download the installer is not a Windows system you will get the Not Supported.

Just select the Windows system that matches the system you will be installer the Bodhi Agent on.

For the mobile applications here is where you can download them to your device.

Bodhi Mobile - iOS Apple Apps Store
Bodhi Mobile - Android Google Play Store

Step 2: Run the installer

alt text

Step 3: Select the Next button to move to the next Button

alt text

Step 4: License agreement screen

alt text

NOTE: the Next Button will be greyed out, until the, I accept the agreement radio button is selected.

Step 5: Select the I accept the agreement Radio Button

alt text

Step 6: Select the Next Button

alt text

Step 7: Selecting the Destination location for the Agent

alt text

NOTE: If this destination location is OK, then select the Next Button.

alt text

Go to Step 8

Step 7a: If you wish to change the location of the destination location
7a. Select the Browse Button

alt text

7b. Select the folder you wish to install the Bodhi Agent into or you can open a different folder.

alt text

7c. After you have selected the folder

alt text

7d. Select the OK Button

alt text

The New destination location should be displayed

alt text

7e. Select the Next Button to continue

alt text

Step 8: Review of Destination location.

alt text

Step 9: Select the Install Button

alt text

9a. A Progress bar will be displayed

alt text

Step 10: Installing Nodejs page

alt text

Step 11: Selecting the Next Button

alt text

Step 12: License agreement screen

alt text

NOTE: the Next Button will be greyed out, until the, I accept the agreement checkbox is selected.

Step 13: Select the I accept the agreement Radio Button

alt text

Step 14: Select the Next Button

alt text

Step 15: Selecting the Destination location for Nodejs

alt text

NOTE: If this destination location is OK, then select the Next Button.

alt text

Go to Step 16

Step 15a: If you wish to change the location of the destination location, Select the change Button

alt text

Step 15b. Select the folder you wish to install nodejs into or you can open a different folder

alt text

Step 15c. After you have selected the new folder

alt text

Step 15d. After you have selected the folder in the new selected folder

alt text

Step 15e. Select the OK Button

alt text

Step 15f. Review the Destination location

alt text

Step 16: Review of the Custom Setup.

alt text

Step 17: Select the Install Button

alt text

15h. A Progress bar will be displayed

alt text

alt text

alt text
figure 19

10b. Command Line Interface is opened

alt text
figure 20

10c. The command line window should close and you will be at the Desktop.

alt text
figure 21

Step 1: Register the Agent with a Mobile Device

Note: If your agent is not registered, it will be unable to send any data to the cloud

alt text
figure 22

Note: If the registration dialog is dismissed before registration * Select the Registration Code Menu item on the left to redisplay it

alt text
figure 23

Step 2: Start the Bodhi Mobile App

alt text
figure 24

Step 3: Enter the a Mobile Device

alt text
figure 25

Step 4: Select the POS Manager

alt text
figure 26

Step 5: Select the the Plus Sign to add a POS to the Manager

alt text
figure 27

Step 6: Select a store to associate the POS with.

Flowers figure 28

Step 7: Enter the Activation code that is displayed in the Browser.

alt text
figure 29

Step 8: Select the Request Button.

alt text
figure 30

Step 9: Verify that POS agent with the selected store and is displayed

alt text
figure 31

Step 20: The Browser will display the console dashboard

alt text
figure 32

Console Dashboard Legend

  1. This is the status of the agent (e.g. Online, Offline)
  2. This changes the Left Menu from Icon Only to Icons and Text

Congratulations on your successful installation of Bodhi Agent

Publishing Applications

Overview

To publish application for the IoT Platform, you need to follow a few simple steps to describe your application.

Publishing Your Application

To publish your application you add the following directory structure for your application:

    /<app-name>/
            /public/

To publish an app into the IoT Platform you have to zip up the following: {code} index.html (could be empty) LICENSE package.json

folder= app_icon.png NewType1.json file (optional) NewType2.json file (optional) NewType3.josn file (optional) …

Example package.json for Mobile Applications

By Clicking on HS Template you get a package.zip file that is downloaded to your desktop that contains the following:

package.json that gets includes with HS Template's zip file:

{
    "name": "HSappTemplate",
    "version": "0.0.0",
    "title": "HSappTemplate",
    "description": "New application Hello, World!",
    "profile": {
        "name": "HSappTemplate",
        "dml": {
            "BodhiApplication": {
                "select": {}
            }
        }
    },
    "settings": {
        "publisher": "",
        "categories": [""],
        "offline": false,
        "navigationBar": "auto",
        "location": "S3",
        "storage": "s3",
        "type":"mobile"
    },
    "dependencies": {
        "bodhi-mobile":"*" 
        },
    "autoUpdateVersion": true
}

See Descriptions of package.json contents below to see what each packge.json entry is for:

{

“name”: “HSappTemplate”,

“version”: “0.0.0”,

“title”: “HSappTemplate”,

“description”: “New application Hello, World!”,

“profile”: {

“name”: “HSappTemplate”,

“dml”: {

“BodhiApplication”: {

“select”: {}

}

}

},

“settings”: {

“publisher”: “”,

“categories”: [“”],

“offline”: false,

“navigationBar”: “auto”,

“location”: “S3”,

“storage”: “s3”,

“type”:“mobile”

},

“dependencies”: {

“bodhi-mobile”:“*”

},

“autoUpdateVersion”: true

}

Example of Package.json for agent or job Applications

Example of package.json for agent or job applications:
#!javascript

{
  "name": "app-package-name",
  "version": "0.0.1",
  "title": "Application Title",
  "description": "Short Application Description.",
  "profile": {
    "name": "app-package-name",
    "dml": {
      “BodhiApplication": {
       "select": {},
       "update":{},
       "delete":{},
       "insert":{}
      },
      "NewType1": {
        "select": {}
      },
      "NewType2": {
        "select": {}
      }
    }
  },
  "settings": {
    "categories": [
      "Aloha",
      "POS"
    ],
    "publisher": "your company",
    "npm_package_name": "app-package-name",


if you have any related apps you want to install together::
"related-apps": [
      "bodhi.aloha-app-transactions",
      "bodhi.aloha-app-store"
    ],
    "public_path": "public",
    "global_store_icon": "public/icon.png",
   "location": "S3",
   "storage": "s3",
   "type": "agent",    
(type can be “job”, “agent”, “mobile”, “web” )   
 "new_type_required": true,
  "install": {
"new": {
"model": [
{
"type": "enumeration",
"name": "TypeName",
"object": "Enumerations/TypeName.json"
},
{
"type": "embedded_type",
"name": "InventoryPurchaseOrder",
"object": "Types/InventoryPurchaseOrder.json"
},
{ "type": "custom_type",
"name": "TypeName2",
"object": "Types/TypeName2.json"
}
],
"post-type-install": [
{"action": "POST",
"object": "Data/DataFile.json",
"path": "/resources/DataFile"
}
]
if you have any parameters required to be used with the app we add this section:: 
 "agent_parameters": {
      "interval": {
        "description": "How often to execute a grind",
        "required": true,
        "type": "string",
        "default": "every 15 minutes",
        "position": 1
      }
    }
  },
  "autoUpdateVersion": false
}

Description of package.json contents

name=“HSappTemplate” required

The name of your application must match the name of the profile

“version”: “0.0.1” required

Ideally this is the version of your application that gets posted as versions show for Agent Application in the Agent Event Logs so keeping this version the same as your Agent Application that is published is highly recommended.

“title”: “Application Title” required

This is the title that will show on the HotSchedules Store once you publish your application to the HotSchedules Store.

“description”: “Short Application Description.” required

The description is the application description that will be displayed with the title for your application when displayed in the HotSchedules Store. Description will be part of “Learn More” button.

“profile”: {} required

The profile section contains the following required sections:

“settings”:{} required

The settings is the main section of package.json contains the following sections:

agent_parameters/job_parameters

Depending on your application needs, you may want to have parameters setup for your applications. Both Agent and Job applications can take parameters. The agent/job_parameters contain information about any parameters that the agent or job requires to run. They contain data_dir formatted information containing description, a required flag, type string and an optional position which is set will position the parameter in the order set 0, 1, 2, etc if not set then the parameter will be displayed in the order it’s defined. Application parameters will be saved under settings so the application should use parameters from settings.

NOTE: The hidden parameter option will not be visible to the user in the installation process but will be written under the application settings.

The following are examples of parameters that can be set for agent or the job applications respectively:

Agent Parameters example:

Example of agent parameters that can be defined for an agent application:

    "agent_parameters": {
      "config_file_path": {
        "description": "Config file location",
        "required": true,
        "type": "string",
        "default": "",
        "setting": "config_file_path"
      },
      "data_dir": {
        "description": "Folder location to save database files for the agent app",
        "required": true,
        "type": "string",
        "default": "C:/bodhiAgent/node_modules/merit-agent-labor/_xmloutput/",
        "setting": "data_dir"
      },
      "number_of_days_to_query": {
        "description": "Limit query to this number of days",
        "required": true,
        "type": "integer",
        "default": 60,
        "setting": "number_of_days_to_query"
      },
      "interval": {
        "description": "How often to execute a grind",
        "required": true,
        "type": "string",
        "default": "every 12 hours",
        "setting": "interval"
      },
      "local_storage_ignore_flag": {
        "description": "Ignore local storage and write all data",
        "required": true,
        "type": "boolean",
        "default": false,
        "setting": "local_storage_ignore_flag"
      }
    }
Job Parameters example:
    "job_parameters": {
      "timing_expression": {
        "description": "How often to execute a job",
        "repeat": true,
        "type": "string",
        "default": "60 minutes"
      },
      "brink_location": {
        "description": "The alpha numeric string provided by the Brink POS API to identify the store location, e.g. tSm8y1TMSk7J4ZMyQBpeTg==",
        "type": "string",
        "required": true,
        "setting": "brink_location"
      },
      "accessToken": {
        "description": "The alpha numeric string provided by the Brink POS API to authenticate the user",
        "type": "string",
        "required": true,
        "setting": "accessToken"
      },
      "uri": {
        "description": "The url for the Brink POS API service e.g. https://api2.brinkpos.net/",
        "type": "string",
        "required": true,
        "setting": "uri"
      }
    }

offline=true/false

Offline controls whether the container will cache application information for offline use. If offline=true and the user launches the application, any data that was previously loaded will be available when the device is offline. This will also enable queuing of data to write to the IoT Platform if the application has write permissions.

single_container_app=true/false

single_container_app tells the container know whether the app should be displayed with a menu (a collection of apps) or as a standalone single app. Bodhi Mobile has single_container_app = false. Bodhi Reveal has single_container_app = true

hide_from_global_store=true/false

hide_from_global_store controls whether the app is available to the general public to see in the global app store. Apps like Settings which cannot be removed should have hide_from_global_store=true

new_type_required=true/false

new_type_required tells the installer of the app in the global app store if the app will run 'out of the box’ or if new custom types need to be installed on the namespace. NOTE:: if new_type_required=true, troubleshooting_url should be required

screenshots{}

The screenshots array contains relative paths to screenshots which the Global App Store will use for display purposes. These files should be included in the app folder that is published and the path should be relative to the public_path.

data_dir:{}

The data_dir formatted information contains a description, a required flag, type string and an optional position which is set will position the parameter in the order set 0, 1, 2, etc if not set then the parameter will be displayed in the order it’s defined.

“autoUpdateVersion”: “false”

This flag prevents autoUpdate version of the app each time you publish. If you mark this false, you need to manually bump the version of the app each time you update it.

Example Type Definition

This is an example of an enumeration, embedded_type and custom_type.

NOTE: All enumerations must be declared first, embedded_type must be after enumerations and custom_types have to be defined after enumerations and embedded_types: This example shows the objects as folders under the application’s root directory. This is where you define your json for each type. There is a one to one correspondence of the type declared in package.json to the json defining that type in the folder under the application.

Defining your custom schema/types example:
"install": {
"new": {
"model": [
{
"type": "enumeration",
"name": "TypeName",
"object": "Enumerations/TypeName.json"
},
{
"type": "embedded_type",
"name": "InventoryPurchaseOrder",
"object": "Types/InventoryPurchaseOrder.json"
},
{ "type": "custom_type",
"name": "TypeName2",
"object": "Types/TypeName2.json"
}
],
"post-type-install": [
{"action": "POST",
"object": "Data/DataFile.json",
"path": "/resources/DataFile"
}
]

Adding Scripts and Versioning: “versions”: [..]

To make an application script available set the following in the settings section of your package.json:

Template for adding scripts/versions to package.json
versions:[
{
    "version": "<script_version>",
    "bundle": "<jar_name>",
    "pre-type-install": {
      "main": "<main_class_name>"
    },
    "post-type-install": {
      "main": "<main_class_name>"
    }
]
Example of versions/scripts using seed-data:
    "versions": [
      {
        "bundle": "installer.jar", 
        "post-type-install": {}, 
        "pre-type-install": {}, 
        "seed-data": [
          {
            "action": "POST", 
            "object": "Data/measurements.json", 
            "path": "/resources/InventoryUnitOfMeasure"
          }, 
          {
            "action": "POST", 
            "object": "Data/conversions.json", 
            "path": "/resources/InventoryUomConversion"
          }
        ], 
        "version": "new"
      }, 
      {
        "bundle": "upgrade-3.0.0.jar", 
        "post-type-install": {
          "main": "com.bodhi.vertx.appinstaller.script.DeveloperScript"
        }, 
        "version": "2.7.19"
      }
    ]

HotSchedules IoT Platform Mobile API

Overview

The HotSchedules IoT Platform Mobile API provides application developers access to native device features for use in web applications. These features are typically unavailable in the HTML5 specification, not uniformly supported across all mobile browsers or improve on the orginal HTML5 spec. In some cases new features have been added that combine several device characteristics into one, for example bar code scanning uses camera storage and image recognition.

There is only one API required to deliver applications on Android IOS mobile devices.

The Bodhi Mobile API provides interface to the native features of a mobile device across iOS and Android.

See descriptions and info below:: (For full implementation details, see our detailed docs on

Bodhi Mobile API

Getting Started

HotSchedules Passbook is a mobile application than allows users to access their data on any mobile device.

With HotSchedules Passbook for IOS and Android you can access and publish applications accessing sales, labor and metrics data. HotSchedules Passbook allows hybrid applications to be deployed and immediately live in HotSchedules Passbook.

Building Your Mobile Application

With HotSchedules Passbook you can build Native, HTML5 or Hybrid applications.

The easiest way to get your app out to customers