Cloud API Reference

The Lockt SecureAccess Cloud API is designed to provider customers with SecureAccess Enterprise the ability to easily integrate with external systems.


This API is intended to be a simple, but powerful way for your organization to access common features of LocktSecure Access from any REST compatible client. New functions and endpoints will be added frequently. Please refer to the documentation below for reference.

Lockt SecureAccess 2.4 or higher is required to utilize the API.
HTTPS
All requests to the Lockt Cloud API must be done so over HTTPS. All other requests will be rejected.

URL
API Urls should be constructed as follows: https://cloudapi.lockt.com/api/[version]/[endpoint]
Example: https://cloudapi.lockt.com/api/v1/users

API Versions
Version URL reference
Version 1.0 v1


Authentication
In order to access the Lockt Cloud API, you must provide valid api credential headers with each request. Your credentials will be supplied as both an apiuser and apikey.

Authentication Header Example
"apiuser" : "9r8ehveyb5h8mnwwet4yf9ugjynz8pkn"
"apikey" : "hqx7wde64vwe987fvg6q4zaautrs3p7j"

Content-Type
All requests must present the Content-Type header with a value of 'application/json'.

Response Codes
Status Code Description
200 The request was processed successfully
400 There was an error processing your request. Details will be supplied in the response body.
401 Access to the indicated resource was denied. Details will be provided in the response body.
404 The resource was not found.
50X An unexpected error has occurred.


Expected Outputs
The following outputs may be encountered while processing create / update calls.
Message Description
No data found or invalid JSON objects supplied. Could not parse input. The body of the request contained no data, or contained incorrectly structured data.
Batch size exceeds maximum of X objects. The supplied payload exceeds the currently allowed number of objects per batch.
Validation errors found. Batch has failed. Details provided. Some objects have failed validation. Details will be provided in the response body.
Unable to enumerate dependant record. Batch has been terminated and exception flagged. A communications error has occurred with your instance of Lockt SecureAccess.
Unable to locate template. Batch has been terminated and exception flagged. A communications error has occurred with your instance of Lockt SecureAccess.
Restriction Description
POST Operation Record Limit POST Operations are currently limited to 100 records per call. Processing larger batches of records requires paging and processing in blocks of 100.
POST Operation Rate Limit Rate limiting is currently being implemented to prevent simultaneous and overlapping POST operations.
The following endpoints are available for use. Details on request and response specifics can be found in the subsequent sections.

Endpoint Method Purpose Comments Status
/user GET List all non-administrative, card holder users in the system. Released
/user?id=id GET Read individual non-administrative, card holder user with the specified id. id represents the Lockt SecureAccess internal id. Released
/user?idnum=idnum GET Read individual non-administrative, card holder user with the specified idnum. idnum represents the user-supplied ID Number in Lockt SecureAccess. Released
/user POST Bulk create new users. Released
/uservalidate POST Bulk create new users validation only run (no changes committed). Pending Release
/credential GET List all credentials in the system. Released
/credential POST Reissue credentials. Pending Release
/credentialsummary GET List summary of credentials claimed and unclaimed. Released
/events GET Return maximum number of locally cached events in the system (default 5000). Released
/events?id=id GET Return most recent events starting with the last event id. id represents the sequential Lockt SecureAccess event internal id. Released
/door GET List all access-controlled doors in the system. Released
/door POST Create access-controlled doors in the system. Released
/doorstate GET List door battery levels. Released
/fob GET List credentials tagged as FOBs. Fob functions are specialized to handle and manipulate credential records that are specifically tagged for use as Fobs. Released
/fob POST Create credentials tagged as FOBs. Fob functions are specialized to handle and manipulate credential records that are specifically tagged for use as Fobs. Released
/fob PUT Reassign credentials tagged as FOBs to a different user, and update expiration date. Fob functions are specialized to handle and manipulate credential records that are specifically tagged for use as Fobs. Released
/fobcheck GET List credentials tagged as FOBs with last activity date. Fob functions are specialized to handle and manipulate credential records that are specifically tagged for use as Fobs. Pending Release
/schedule GET List all schedules in the system. Released
/accesslevel GET List all access levels in the system. Released
/nextcardnum GET Get the next sequentially available card number. Pending Release
All response calls to the API will return in a standard format as indicated below.

GET Requests (Read)
Node Description
data The body of the response return as an array of response objects.
errors Any processing or validation errors will appear in the data node, returned as an array of error objects.
Response Format
#Standard Response
{
    "data": {
        [array of response objects]
    }
}

#Error Response
{
    "data": {
        {"error":"error message"}
    }
}

                                            


POST Requests (Write)
Node Description
process summary The number of records submitted, processed, and errors.
errors Any processing or validation errors will appear in the errors node of the data object.
Response Format
                                            
                                            
#Result if the process succeeds and no errors
{
    "data": {
        "submitted": number of records submitted,
        "inserted": number of records inserted,
        "updated": number of records updated,
        "errors": number of errors encountered
    }
}

#Result if errors are encountered
{
    "result": [Array of text messages indicating what caused the problem],
    "errors": [Array of error objects that indicate what specifically occurred]
}

#Example errors encountered updating users
{
    "error": [
        "Non-Numeric card_num found: A8914",
        "Invalid email address found: rgreswell0@@@@gravatar.com"
    ],
    "input_data": {
        "id": -1,
        "id_num": "qjwi-880329359",
        "first_name": "Rhea",
        "last_name": "Greswell",
        "card_num": "A8914",
        "email": "rgreswell0@@@@gravatar.com",
        "phone": "8184365134",
        "access_effective": "2022-01-24 00:00:00",
        "access_expires": "2022-10-29 00:00:00",
        "pin": "0986",
        "enabled": false,
        "accesslevels": [
            {
                "id": 574
            }
        ]
    }
}
                                            
                                            
Entity Model


Domain Model


Relationships
Object Description
User Users represent individual credential holders in Lockt SecureAccess. User objects contain basic information such as name, id_num, email and phone. User objects also reference other objects such as access levels and credentials. Users can be assigned to multiple access levels and can hold multiple credentials.
Fobs Fobs are special derivatives of user records that are used specifically for the purpose of managing fob devices. Like users, fob objects also reference other objects such as access levels and credentials. Fobs can be assigned to multiple access levels and can hold multiple credentials
Credential Credentials represent digital access keys and are used to uniquely identify a user in the Best Switch Mobile app. Users can hold multiple credentials. But, credentials can only be held by one user.
Access Levels Access Levels represent logical groups of doors that are tied to schedules. Access Levels are similar to security groups as they combine a collection of doors that, when assigned to a user, grant the user access to the door on the indicated schedule.
Doors Doors are individual openings over which the system governs access. Multiple doors can be assigned to access levels. Likewise, multiple access levels can reference the same door.
Schedules Schedules represent a collection of individual days and start / stop times. Schedules are applied to access levels and are used to determine which days and times to grant access to a door, via an access level.
Events Events are representations of actions that have occurred within the system. Events reference numerous objects, including several objects that are not callable through the API.
Case Process
Create New User and Assign to Access Level
  1. Call accesslevels GET end point.
  2. Process collection of accesslevels to retrieve the id of the required accesslevel.
  3. Construct user object containing all user information.
  4. Create array of accesslevels to assign to user object and attach to user object.
  5. Call user POST endpoint using user object.
  6. POST call will validate the input and return any validation or other errors that may occur.
  7. If the POST is successful, the user will be created in Lockt SecureAccess.
Disable Access For a User (Assuming ID of user is known)
  1. Call user GET end point with id query parameter (?id={id}) to retrieve the user object.
  2. Construct user object containing all user information.
  3. Set the access_expires parameter on the user object.
  4. Call user POST endpoint using user object.
  5. POST call will validate the input and return any validation or other errors that may occur.
  6. If the POST is successful, the user's access will be expired on the supplied date/time.

Purpose
List all non-administrative, card holder users in the system.

REST Method
GET

Request URL
https://cloudapi.lockt.com/api/v1/user

User Object Definition
Property Data Type Description
id integer The unique, system assigned id of the user
id_num string Unique id number to identify the user. Supplied by external system.
first_name string The first name of the user.
last_name string The last name of the user.
card_num string The card number assigned to the user.
credential_key string The credential registration key assigned to the user.
email string The email address associated with the user.
phone string The phone number associated with the user.
access_effective date-time The date/time when access is enabled for this user.
access_expires date-time The date/time when access is disabled for this user.
accesslevels array An array of access level assignment objects associated with this users.


Code Examples
import json
import requests

apiuser = "9r8ehveyb5h8mnwwet4yf9ugjynz8pkn"
apikey =  "hqx7wde64vwe987fvg6q4zaautrs3p7j"

headers = {"Content-type", "application/json", "apiuser":apiuser ,"apikey":apikey}
url = "https://cloudapi.lockt.com/api/v1/user"

r = requests.get(url, headers=headers)
data = r.json()
if r.status_code == 200:        
    #process the response    
else:
    #check for failed response



Example Response
{
    "data": [
        {
            "id": 5678,
            "id_num": "",
            "name": "Fob 1",
            "card_num": "10000",
            "credential_key": "",
            "enabled": false,
            "access_effective": "",
            "access_expires": "",
            "accesslevels": []
        },
        {
            "id": 6789,
            "id_num": "",
            "name": "Fob 2",
            "card_num": "10001",
            "credential_key": "",
            "enabled": false,
            "access_effective": "2022-05-05T09:00:00.000Z",
            "access_expires": "2022-05-05T12:00:00.000Z",
            "accesslevels": []
        }
    ]
}

Purpose
Read individual non-administrative, card holder user with the specified id.

REST Method
GET

Request URL
https://cloudapi.lockt.com/api/v1/user?id=id

User Object Definition
Property Data Type Description
id integer The unique, system assigned id of the user
id_num string Unique id number to identify the user. Supplied by external system.
first_name string The first name of the user.
last_name string The last name of the user.
card_num string The card number assigned to the user.
credential_key string The credential registration key assigned to the user.
email string The email address associated with the user.
phone string The phone number associated with the user.
access_effective date-time The date/time when access is enabled for this user.
access_expires date-time The date/time when access is disabled for this user.
accesslevels array An array of access level assignment objects associated with this users.


Code Examples
import json
import requests

apiuser = "9r8ehveyb5h8mnwwet4yf9ugjynz8pkn"
apikey =  "hqx7wde64vwe987fvg6q4zaautrs3p7j"
id = 1693

headers = {"Content-type", "application/json", "apiuser":apiuser ,"apikey":apikey}
url = "https://cloudapi.lockt.com/api/v1/user?id=" + str(id)

r = requests.get(url, headers=headers)
data = r.json()
if r.status_code == 200:        
    #process the response    
else:
    #check for failed response



Example Response
{
    "data": [
        {
            "id": 1693,
            "id_num": "",
            "last_name": "Brown3",
            "first_name": "Susan3",
            "card_num": "8769",
            "credential_key": "",
            "email": "susan.brown@web.place",
            "phone": "33344455555",
            "access_effective": "",
            "access_expires": "",
            "enabled": true
        }
    ]
}

Purpose
Read individual non-administrative, card holder user with the specified idnum.

REST Method
GET

Request URL
https://cloudapi.lockt.com/api/v1/user?idnum=idnum

User Object Definition
Property Data Type Description
id integer The unique, system assigned id of the user
id_num string Unique id number to identify the user. Supplied by external system.
first_name string The first name of the user.
last_name string The last name of the user.
card_num string The card number assigned to the user.
credential_key string The credential registration key assigned to the user.
email string The email address associated with the user.
phone string The phone number associated with the user.
access_effective date-time The date/time when access is enabled for this user.
access_expires date-time The date/time when access is disabled for this user.
accesslevels array An array of access level assignment objects associated with this users.


Code Examples
import json
import requests

apiuser = "9r8ehveyb5h8mnwwet4yf9ugjynz8pkn"
apikey =  "hqx7wde64vwe987fvg6q4zaautrs3p7j"
idnum = "ABC123-98765"

headers = {"Content-type", "application/json", "apiuser":apiuser ,"apikey":apikey}
url = "https://cloudapi.lockt.com/api/v1/user?idnum=" + str(idnum)

r = requests.get(url, headers=headers)
data = r.json()
if r.status_code == 200:        
    #process the response    
else:
    #check for failed response



Example Response
{
    "data": [
        {
            "id": 1690,
            "id_num": "ABC123-98765",
            "last_name": "Smith3",
            "first_name": "Joe3",
            "card_num": "5556",
            "credential_key": "",
            "email": "j.smith@web.place",
            "phone": "1112223333",
            "access_effective": "2022-01-05T23:59:59.000Z",
            "access_expires": "",
            "enabled": false
        }
    ]
}

Purpose
Create/update users in the system.

REST Method
POST

Request URL
https://cloudadpi.lockt.com/v1/user/

Request Body Parameters
The body of the user create contains the following nodes:
Node Description
users An array of user objects to be created.
options Contains processing instructions for the operation.


Request Body Format
{
  "users": [array of user objects],
  "options": {processing options}  
}


User Object Definition
Property Data Type Description
id integer The unique, system assigned id of the user
id_num string Unique id number to identify the user. Supplied by external system.
first_name string The first name of the user.
last_name string The last name of the user.
card_num string The card number assigned to the user.
credential_key string The credential registration key assigned to the user.
email string The email address associated with the user.
phone string The phone number associated with the user.
access_effective date-time The date/time when access is enabled for this user.
access_expires date-time The date/time when access is disabled for this user.
accesslevels array An array of access level assignment objects associated with this users.


Access Level Object Definition
Property Data Type Description
id integer The unique, system assigned id of the access level.
name string The name of the access level. This property is ignored in create/update requests.
doors array An array of abbreviated Door objects containing Door Name and ID only. This property is not returned if no Doors are assigned to the Access Level.


Processing Options Object Definition
Property Data Type Description
update_existing boolean If set to false, any user objects submitted with a matching id_num or email address will be ignored. If set to true, the system will attempt to update existing records by matching id_num and email address. This property defaults to false if not presented.
validate_fails_batch boolean If set to false, validation errors will be returned in the response body and records passing validation will be processed. If set to true, a validation error will fail the entire batch. This property defaults to true if not presented.
replace_privileges boolean If set to false, privileges will be added to the user's existing privileges. If set to true, the existing privileges will be deleted and the new privileges added. This property defaults to true if not presented.


Example Request Body
{
  "users": [
    {
        "id": 4432,
        "id_num": "ABC123",
        "last_name": "Peters",
        "first_name": "Toby",
        "card_num": "8769",
        "credential_key": "",
        "email": "toby.peters@web.place",
        "phone": "33344455555",
        "access_effective": "",
        "access_expires": "",
        "enabled": "true",
        "accesslevels": [
                {"id": 123},
                {"id": 789}
        ]
    },
    {
        "id": 7612,
        "id_num": "DEF567",
        "last_name": "Wilson",
        "first_name": "Dana",
        "card_num": "8769",
        "credential_key": "",
        "email": "dana.wilson@web.place",
        "phone": "33344455555",
        "access_effective": "",
        "access_expires": "",
        "enabled": "true",
        "accesslevels": [
                {"id": 123},
                {"id": 789}
        ]
    }
  ],
  "options": {
        "update_existing": "true",
        "validate_fails_batch": "false",
        "replace_privileges": "true"
  }
}


Code Examples
import json
import requests

apiuser = '9r8ehveyb5h8mnwwet4yf9ugjynz8pkn'
apikey =  'hqx7wde64vwe987fvg6q4zaautrs3p7j'

headers = {'Content-type', 'application/json', 'apiuser':apiuser ,'apikey':apikey}
url = 'https://cloudapi.lockt.com/api/v1/user'

usernode = {}
userdata = [{} for i in range(2)]
userdata[0] = {'id':4432,'id_num':'ABC123','last_name':'Peters','first_name':'Toby','card_num':'5588','credential_key':'','email':'toby.peters@web.place','phone':'33344455555','access_effective':'','access_expires':'','enabled':'true'}
userdata[1] = {'id':7612,'id_num':'DEF567','last_name':'Wilson','first_name':'Dana','card_num':'9900','credential_key':'','email':'dana.wilson@web.place','phone':'33344455555','access_effective':'','access_expires':'','enabled':'true'}
usernode['users'] = userdata
usernode['options'] = {'update_existing':'true','validate_fails_batch':'true','replace_privileges':'true'}
userjson = json.dumps(usernode)

r = requests.post(url, data=userjson, headers=headers)
data = r.json()
if r.status_code == 200:        
    #process the response    
else:
    #check for failed response



Response Body Format
{
    "data": {
        "submitted": number of records submitted,
        "inserted": number of records inserted,
        "updated": number of records updated,
        "errors": number of errors encountered
    }
}


Example Response
{
    "data": {
        "submitted": 1,
        "inserted": 0,
        "updated": 1,
        "errors": 0
    }
}

Purpose
List all non-administrative, card holder users in the system.

REST Method
GET

Request URL
https://cloudapi.lockt.com/api/v1/credential

User Object Definition
Property Data Type Description
id integer The unique, system assigned id of the credential.
card_num string The card number assigned to the user.
credential_key string The credential registration key assigned to the user.
claim_status string Indicates if credential is claimed.
user object Abbreviated object for the user to which the credential is assigned.


Code Examples
import json
import requests

apiuser = "9r8ehveyb5h8mnwwet4yf9ugjynz8pkn"
apikey =  "hqx7wde64vwe987fvg6q4zaautrs3p7j"

headers = {"Content-type", "application/json", "apiuser":apiuser ,"apikey":apikey}
url = "https://cloudapi.lockt.com/api/v1/credential"

r = requests.get(url, headers=headers)
data = r.json()
if r.status_code == 200:        
    #process the response    
else:
    #check for failed response



Example Response
{
    "data": [
        {
            "id": 335,
            "card_num": "1003",
            "credential_key": "AAAA-BBBB-1111-2222",
            "claim_status": "Claimed",
            "user": [
                {
                    "id": 300,
                    "name": "User, Test"
                }
            ]
        },
        {
            "id": 129813,
            "card_num": "1234",
            "credential_key": "CCCC-DDDD-5555-6666",
            "claim_status": "Unclaimed",
            "user": [
                {
                    "id": 244,
                    "name": "Greswell, Rhea"
                }
            ]
        }
    ]
}

Purpose
Read all available events, up to a maximum of 5000 records.

REST Method
GET

Request URL
https://cloudapi.lockt.com/api/v1/events

Event Object Definition
Property Data Type Description
id integer The unique, system assigned id of the event
device string The name device causing the event
code integer The integer representation of the event code
code_text string The text rerpresentation of the event code
subcode integer The integer representation of the event sub-code
subcode_text string The text rerpresentation of the event sub-code
schedule string The name of the schedule, if applicable
controller string The name of the controller, if applicable
location string The name of the location where the device is assigned, if applicable
card_num string The card number assigned to the user
user string The name of the user
category integer The integer representation of the event category
category_text string The text representation of the event category
event_time date-time The event timestamp received from the device
db_time date-time The timestamp when the event was recorded in the system


Code Examples
import json
import requests

apiuser = "9r8ehveyb5h8mnwwet4yf9ugjynz8pkn"
apikey =  "hqx7wde64vwe987fvg6q4zaautrs3p7j"

headers = {"Content-type", "application/json", "apiuser":apiuser ,"apikey":apikey}
url = "https://cloudapi.lockt.com/api/v1/events"

r = requests.get(url, headers=headers)
data = r.json()
if r.status_code == 200:        
    #process the response    
else:
    #check for failed response



Example Response
{
    "data": [
        {
            "id": 865,
            "device": "Core 1",
            "code": 49,
            "code_text": "Access Denied",
            "subcode": 104,
            "subcode_text": "Battery Missing",
            "schedule": "",
            "controller": "Switch™ Bridge",
            "location": "Main Hall",
            "card_num": "1000",
            "user": "Jones, Adam",
            "category": 2,
            "category_text": "Door Access Denied",
            "hw_time": "2021-11-18T16:15:28.000Z",
            "db_time": "2021-11-19T00:47:09.651Z"
        },
        {
            "id": 864,
            "device": "Core 1",
            "code": 49,
            "code_text": "Access Denied",
            "subcode": 104,
            "subcode_text": "Battery Missing",
            "schedule": "",
            "controller": "Switch™ Bridge",
            "location": "Main Hall",
            "card_num": "1000",
            "user": "Smith, Sally",
            "category": 2,
            "category_text": "Door Access Denied",
            "hw_time": "2021-11-18T16:15:25.000Z",
            "db_time": "2021-11-19T00:44:06.950Z"
        },
        {
            "id": 837,
            "device": "Core 2",
            "code": 48,
            "code_text": "Access Granted",
            "schedule": "",
            "controller": "Switch™ Bridge",
            "location": "",
            "card_num": "1001",
            "user": "Jackson, Kelly",
            "category": 1,
            "category_text": "Door Access Granted",
            "hw_time": "2021-11-17T13:58:01.000Z",
            "db_time": "2021-11-17T13:58:07.035Z"
        }
    ]
}

Purpose
Retrieve a list of event objects after the specified id.

REST Method
GET

Request URL
https://cloudapi.lockt.com/api/v1/events?id=id

Request Parameters
Name Description Data Type Optional / Required
id A numeric id representing the unique record identifier in Lockt SecureAccess integer required


Event Object Definition
Property Data Type Description
id integer The unique, system assigned id of the event
device string The name device causing the event
code integer The integer representation of the event code
code_text string The text rerpresentation of the event code
subcode integer The integer representation of the event sub-code
subcode_text string The text rerpresentation of the event sub-code
schedule string The name of the schedule, if applicable
controller string The name of the controller, if applicable
location string The name of the location where the device is assigned, if applicable
card_num string The card number assigned to the user
user string The name of the user
category integer The integer representation of the event category
category_text string The text representation of the event category
event_time date-time The event timestamp received from the device
db_time date-time The timestamp when the event was recorded in the system


Code Examples
import json
import requests

apiuser = "9r8ehveyb5h8mnwwet4yf9ugjynz8pkn"
apikey =  "hqx7wde64vwe987fvg6q4zaautrs3p7j"
lastid = 17249

headers = {"Content-type", "application/json", "apiuser":apiuser ,"apikey":apikey}
url = "https://cloudapi.lockt.com/api/v1/events?id=" + str(lastid)

r = requests.get(url, headers=headers)
data = r.json()
if r.status_code == 200:        
    #process the response    
else:
    #check for failed response



Example Response
{
    "data": [
        {
            "id": 865,
            "device": "Core 1",
            "code": 49,
            "code_text": "Access Denied",
            "subcode": 104,
            "subcode_text": "Battery Missing",
            "schedule": "",
            "controller": "Switch™ Bridge",
            "location": "Main Hall",
            "card_num": "1000",
            "user": "Jones, Adam",
            "category": 2,
            "category_text": "Door Access Denied",
            "hw_time": "2021-11-18T16:15:28.000Z",
            "db_time": "2021-11-19T00:47:09.651Z"
        },
        {
            "id": 864,
            "device": "Core 1",
            "code": 49,
            "code_text": "Access Denied",
            "subcode": 104,
            "subcode_text": "Battery Missing",
            "schedule": "",
            "controller": "Switch™ Bridge",
            "location": "Main Hall",
            "card_num": "1000",
            "user": "Smith, Sally",
            "category": 2,
            "category_text": "Door Access Denied",
            "hw_time": "2021-11-18T16:15:25.000Z",
            "db_time": "2021-11-19T00:44:06.950Z"
        }
    ]
}

Purpose
List all doors in the system.

REST Method
GET

Request URL
https://cloudapi.lockt.com/api/v1/door

User Object Definition
Property Data Type Description
id integer The unique, system assigned id of the door.
type string Text description of the door type
name string The name of the door
location string The location of the door.
enabled boolean Indicates whether the door is currently enabled or disabled.
controller string The name of the controller to which the door is attached.


Code Examples
import json
import requests

apiuser = "9r8ehveyb5h8mnwwet4yf9ugjynz8pkn"
apikey =  "hqx7wde64vwe987fvg6q4zaautrs3p7j"

headers = {"Content-type", "application/json", "apiuser":apiuser ,"apikey":apikey}
url = "https://cloudapi.lockt.com/api/v1/door"

r = requests.get(url, headers=headers)
data = r.json()
if r.status_code == 200:        
    #process the response    
else:
    #check for failed response



Example Response
{
    "data": [
        {
            "id": 166,
            "type": "Access Controlled Door",
            "name": "Office Supplies",
            "location": "Main Hall",
            "enabled": true,
            "controller": "BEST Switch™ API"
        },
        {
            "id": 174,
            "type": "Access Controlled Door",
            "name": "Hall Entrance",
            "location": "",
            "enabled": true,
            "controller": "BEST Switch™ API"
        },
        {
            "id": 603,
            "type": "Access Controlled Door",
            "name": "Maintenance Office",
            "location": "",
            "enabled": true,
            "controller": "BEST Switch™ API"
        }
    ]
}

Purpose
Creates doors in the system. Specifically, creates Switch&Trade;Tech doors linked to the Switch&Trade;Tech controller.

REST Method
POST

Request URL
https://cloudapi.lockt.com/api/v1/door

Request Body Parameters
The body of the user create contains the following nodes:
Node Description
doors An array of user objects to be created.
options Contains processing instructions for the operation.


Request Body Format
{
  "doors": [array of door objects],
  "options": {processing options}  
}


Door Object Definition
Property Data Type Description
name text The name of the door


Processing Options Object Definition
Property Data Type Description
validate_fails_batch boolean If set to false, validation errors will be returned in the response body and records passing validation will be processed. If set to true, a validation error will fail the entire batch. This property defaults to true if not presented.


Example Request Body
{
  "doors": [
    {
        "name": "Door 1"
    },
    {
        "name": "Door 2"
    }
  ],
  "options": {
        "validate_fails_batch": "false"
  }
}


Code Examples
import json
import requests

apiuser = '9r8ehveyb5h8mnwwet4yf9ugjynz8pkn'
apikey =  'hqx7wde64vwe987fvg6q4zaautrs3p7j'

headers = {'Content-type', 'application/json', 'apiuser':apiuser ,'apikey':apikey}
url = 'https://cloudapi.lockt.com/api/v1/door'

doornode = {}
doordata = [{} for i in range(2)]
doordata[0] = {'name':'Door 1'}
doordata[1] = {'name':'Door 2'}
doordata['users'] = doordata
doordata['options'] = {'validate_fails_batch':'true'}
doorjson = json.dumps(doornode)

r = requests.post(url, data=doorjson, headers=headers)
data = r.json()
if r.status_code == 200:        
    #process the response    
else:
    #check for failed response



Example Response - Success
{
    "data": {
        "submitted": 1,
        "inserted": 1,
        "updated": 1,
        "errors": 0
    }
}


Example Response - Errors
{
    "result": [
        "Validation errors found. Batch has failed. Details provided."
    ],
    "errors": [
        {
            "error": [
                "Door Name Already Exists: Door 1"
            ],
            "input_data": {
                "name": "Door 1"
            }
        }
    ]
}

Purpose
List all doors states in the system.

REST Method
GET

Request URL
https://cloudapi.lockt.com/api/v1/doorstate

User Object Definition
Property Data Type Description
id integer The unique, system assigned id of the door.
name string The name of the door
battery_level decimal The battery level of the door expressed as a decimal, if applicable.


Code Examples
import json
import requests

apiuser = "9r8ehveyb5h8mnwwet4yf9ugjynz8pkn"
apikey =  "hqx7wde64vwe987fvg6q4zaautrs3p7j"

headers = {"Content-type", "application/json", "apiuser":apiuser ,"apikey":apikey}
url = "https://cloudapi.lockt.com/api/v1/doorstate"

r = requests.get(url, headers=headers)
data = r.json()
if r.status_code == 200:        
    #process the response    
else:
    #check for failed response



Example Response
{
    "data": [
        {
            "id": 187,
            "name": "Room 1",
            "battery_level": 0.64
        },
        {
            "id": 446,
            "name": "Room 2",
            "battery_level": 0.74
        },
        {
            "id": 611127,
            "name": "Room 3",
            "battery_level": 0.99
        }
    ]
}

Purpose
List all fobs in the system. Fobs are credential objects that are specifically tagged to be used as Fobs.

REST Method
GET

Request URL
https://cloudapi.lockt.com/api/v1/fob

Fob Object Definition
Property Data Type Description
id_num text Unique id number to identify the fob. Supplied by external system.
name string The name of the fob.
card_num string The card number assigned to the fob.
credential_key string The credential registration key assigned to the fob.
enabled boolean Indicates whether the fob is enabled.
access_effective date-time The date/time when access is enabled for this fob.
access_expires date-time The date/time when access is disabled for this fob.
accesslevels array An array of access level assignment objects associated with this fobs.


Code Examples
import json
import requests

apiuser = "9r8ehveyb5h8mnwwet4yf9ugjynz8pkn"
apikey =  "hqx7wde64vwe987fvg6q4zaautrs3p7j"

headers = {"Content-type", "application/json", "apiuser":apiuser ,"apikey":apikey}
url = "https://cloudapi.lockt.com/api/v1/door"

r = requests.get(url, headers=headers)
data = r.json()
if r.status_code == 200:        
    #process the response    
else:
    #check for failed response



Example Response
{
    "data": [
        {
            "id": 166,
            "type": "Access Controlled Door",
            "name": "Office Supplies",
            "location": "Main Hall",
            "enabled": true,
            "controller": "BEST Switch™ API"
        },
        {
            "id": 174,
            "type": "Access Controlled Door",
            "name": "Hall Entrance",
            "location": "",
            "enabled": true,
            "controller": "BEST Switch™ API"
        },
        {
            "id": 603,
            "type": "Access Controlled Door",
            "name": "Maintenance Office",
            "location": "",
            "enabled": true,
            "controller": "BEST Switch™ API"
        }
    ]
}

Purpose
Creates new Fob records. Fobs are credential objects that are specifically tagged to be used as Fobs.

REST Method
POST

Request URL
https://cloudapi.lockt.com/api/v1/fob

Request Body Format
{
  "fobs": [array of fob objects]
}


Fob Object Definition
Property Data Type Description
id integer The unique, system assigned id of the fob
id_num string Unique id number to identify the fob. Supplied by external system.
name string The name of the fob.
card_num string The card number assigned to the fob.
access_effective date-time The date/time when access is enabled for this fob.
access_expires date-time The date/time when access is disabled for this fob.


Example Request Body
{
   "fobs": [
   {
    "name": "Fob 1",
    "id_num": "ABC123",
    "card_num": 5599,
    "access_effective": "2022-05-05 05:00:00",
    "access_expires": "2022-05-25 08:00:00"
   }
  ]
}


Code Examples
import json
import requests

apiuser = '9r8ehveyb5h8mnwwet4yf9ugjynz8pkn'
apikey =  'hqx7wde64vwe987fvg6q4zaautrs3p7j'

headers = {'Content-type', 'application/json', 'apiuser':apiuser ,'apikey':apikey}
url = 'https://cloudapi.lockt.com/api/v1/fob'

fobnode = {}
fobdata = [{} for i in range(1)]
fobdata[0] = {'name':'Fob 1','id_num':'ABC123','card_num':'5599','access_effective':'','access_expires':''}
fobnode['fobs'] = fobdata
fobjson = json.dumps(fobnode)

r = requests.post(url, data=fobjson, headers=headers)
data = r.json()
if r.status_code == 200:        
    #process the response    
else:
    #check for failed response



Response Body Format
{
    "data": {
        "submitted": number of records submitted,
        "inserted": number of records inserted,
        "updated": number of records updated,
        "errors": number of errors encountered
    }
}


Example Response
{
    "data": {
        "submitted": 1,
        "inserted": 1,
        "updated": 0,
        "errors": 0
    }
}

Purpose
Reassigns a Fob to an indicated User record, thereby inheriting access rights. Fobs are credential objects that are specifically tagged to be used as Fobs.

REST Method
PUT

Request URL
https://cloudapi.lockt.com/api/v1/fob

Request Body Format
{
  "fobs": [array of fob objects]
}


Fob Object Definition
Property Data Type Description
id integer The unique, system assigned id of the fob
user_id string The unique, system assigned id of the user record to which tis fob will be assigned
access_effective timestamp The date/time when access is enabled for this fob.
access_expires timestamp The date/time when access is disabled for this fob.


Example Request Body
{
   "fobs": [
   {
    "id": "613297",
    "user_id": "613188",
    "access_effective": "2022-06-10 05:00:00",
    "access_expires": "2022-06-10 08:00:00"
   }
  ]
}


Code Examples
import json
import requests

apiuser = '9r8ehveyb5h8mnwwet4yf9ugjynz8pkn'
apikey =  'hqx7wde64vwe987fvg6q4zaautrs3p7j'

headers = {'Content-type', 'application/json', 'apiuser':apiuser ,'apikey':apikey}
url = 'https://cloudapi.lockt.com/api/v1/fob'

fobnode = {}
fobdata = [{} for i in range(1)]
fobdata[0] = {'id':12345,'user_id':87654}
fobnode['fobs'] = fobdata
fobjson = json.dumps(fobnode)

r = requests.put(url, data=fobjson, headers=headers)
data = r.json()
if r.status_code == 200:        
    #process the response    
else:
    #check for failed response



Response Body Format
{
    "data": {
        "submitted": number of records submitted,
        "inserted": number of records inserted,
        "updated": number of records updated,
        "errors": number of errors encountered
    }
}


Example Response
{
    "data": {
        "submitted": 1,
        "inserted": 1,
        "updated": 0,
        "errors": 0
    }
}

Purpose
List all schedules in the system.

REST Method
GET

Request URL
https://cloudapi.lockt.com/api/v1/schedule

User Object Definition
Property Data Type Description
id integer The unique, system assigned id of the schedule.
name string The name of the schedule.
d0 bit Will be set to 1 if the schedule includes day 0 (typically Monday).
d1 bit Will be set to 1 if the schedule includes day 1 (typically Tuesday).
d2 bit Will be set to 1 if the schedule includes day 2 (typically Wednesday).
d3 bit Will be set to 1 if the schedule includes day 3 (typically Thursday).
d4 bit Will be set to 1 if the schedule includes day 4 (typically Friday).
d5 bit Will be set to 1 if the schedule includes day 5 (typically Saturday).
d6 bit Will be set to 1 if the schedule includes day 6 (typically Sunday).
start time The time the schedule starts in format HH:MM:SS
stop time The time the schedule stops in format HH:MM:SS


Code Examples
import json
import requests

apiuser = "9r8ehveyb5h8mnwwet4yf9ugjynz8pkn"
apikey =  "hqx7wde64vwe987fvg6q4zaautrs3p7j"

headers = {"Content-type", "application/json", "apiuser":apiuser ,"apikey":apikey}
url = "https://cloudapi.lockt.com/api/v1/schedule"

r = requests.get(url, headers=headers)
data = r.json()
if r.status_code == 200:        
    #process the response    
else:
    #check for failed response



Example Response
{
    "data": [
        {
            "id": 543,
            "name": "0800-1700 M-F, 1200-1500 Sat",
            "d0": 1,
            "d1": 1,
            "d2": 1,
            "d3": 1,
            "d4": 1,
            "d5": 0,
            "d6": 0,
            "start": "08:00:00",
            "stop": "16:59:59"
        },
        {
            "id": 1404,
            "name": "Weekend Cleaners",
            "d0": 0,
            "d1": 0,
            "d2": 0,
            "d3": 0,
            "d4": 0,
            "d5": 1,
            "d6": 1,
            "start": "06:40:00",
            "stop": "19:49:59"
        }
    ]
}

Purpose
List all access levels in the system.

REST Method
GET

Request URL
https://cloudapi.lockt.com/api/v1/accesslevel

Access Level Object Definition
Property Data Type Description
id integer The unique, system assigned id of the access level.
name string The name of the access level. This property is ignored in create/update requests.
doors array An array of abbreviated Door objects containing Door Name and ID only. This property is not returned if no Doors are assigned to the Access Level.


Code Examples
import json
import requests

apiuser = "9r8ehveyb5h8mnwwet4yf9ugjynz8pkn"
apikey =  "hqx7wde64vwe987fvg6q4zaautrs3p7j"

headers = {"Content-type", "application/json", "apiuser":apiuser ,"apikey":apikey}
url = "https://cloudapi.lockt.com/api/v1/accesslevel"

r = requests.get(url, headers=headers)
data = r.json()
if r.status_code == 200:        
    #process the response    
else:
    #check for failed response



Example Response
{
    "data": [
        {
            "id": 208,
            "name": "Security",
            "doors": [
                {
                    "id": 983,
                    "name": "Office Door"
                },
                {
                    "id": 1087,
                    "name": "Front Door"
                }
            ]
        },
        {
            "id": 212,
            "name": "Administration"
        },
        {
            "id": 512,
            "name": "Cardholder"
        },
        {
            "id": 574,
            "name": "Housekeeping",
            "doors": [
                {
                    "id": 1087,
                    "name": "Front Door"
                }
            ]
        }
    ]
}