API Reference

Setup

Client.UserClient(systemkey, systemsecret, email, password, platformURL)

    systemKey // string
        Required. The systemKey of the system to connect to. Retrievable from the Console's System Settings.
    systemSecret // string
        Required. The systemSecret of the system to connect to. Retrievable from the Console's System Settings.
    email // string
        Email of non-dev user to connect to system as. If registerUser key is not provided, the user must be registered through the Auth tab of the console, and given appropriate roles.
    password // string
        Password of non-dev user to connect to system as.
    platformURL // string
        URL for platform (e.g. https://platform.clearblade.com) 

Client.DevClient(systemkey, systemsecret, deviceName, deviceActiveKey, platformURL)

    systemKey // string
        Required. The systemKey of the system to connect to. Retrievable from the Console's System Settings.
    systemSecret // string
        Required. The systemSecret of the system to connect to. Retrievable from the Console's System Settings.
    deviceName // string
        Required. The name of the device to connect to the system as. If registerUser key is not provided, the user must be registered through the Auth tab of the console, and given appropriate roles.
    deviceActiveKey // string
        Required. The current active key, specified in the Devices collection, for the device.
    platformURL // string
        URL for platform (e.g. https://platform.clearblade.com) 

Authentication

auth.Authenticate(UserClient/DevClient object)

Authenticates credentials set on userClient/devClient and sets session token

auth.RegisterUser(username, password, userClient)

Register a new user with the platform.

    username // string
        Email of the new user
    password // string
        Password of the new user

auth.RegisterDevUser(username, password, userClient)

Register a new user with the platform.

    username // string
        Email of the new user
    password // string
        Password of the new user

Code Services

userClient.CallService(systemKey, name string, params)

Run a named code service that exists on the system with options, and returns the response object or an error

    systemKey // string
        Key to system that contains desired code service
    name // string
        Name of code service to be executed
    params // dict {}
        Request object to be passed to code service function on execution

Messaging

Create Messaging object

message = Messaging.Messaging(userClient)

message.InitializeMQTT()

message.publishMessage(topic, message, qos)

Publish message on MQTT topic

    topic // string
        MQTT topic to publish on
    message // string
        String message
    qos // int
        QOS priority for message

message.Subscribe(topic, qos)

Asynchronously subscribe to MQTT topic and push messages onto channel as they arrive

Warning

Topics with leading forward slashes ‘/’ are stripped. Ex. Topic ‘/a/b/c’ becomes ‘a/b/c’

    topic // string
        MQTT topic to subscribe
    qos // int
        QOS priority for message

message.Unsubscribe(topic)

Stop subscription to MQTT topic

    topic // string
        MQTT topic to unsusbcribe

message.Disconnect() error

End MQTT connection for set user