Skip to content

CustomDomain

Outgoing Messages

HandleDirective

Notifies the platform on a new custom directive.

JSON Structure

{
    "header": {
        "version": "4.0",
        "messageType": "Publish",
        "id": {{String}},
        "messageDescription": {
            "topic": "CustomDomain",
            "action": "HandleDirective"
        }
    },
    "payload": {
        "directiveNamespace": {{String}},
        "directiveName": {{String}},
        "directivePayload": {{String}},
        "correlationToken": {{String}},
        "messageId": {{String}}        
    }
}

Payload

Property Type Required Description Example
directiveNamespace String Yes The namespace of the custom directive to be handled.
directiveName String Yes The name of the custom directive.
directivePayload String Yes An opaque JSON payload sent to the device.
correlationToken String Yes An opaque token that must be included in any events responding to this directive.
messageId String Yes A unique ID used to identify a specific directive. Used to report directive handling result.

CancelDirective

Notifies the platform to cancel the specific directive with given messageId.

JSON Structure

{
    "header": {
        "version": "4.0",
        "messageType": "Publish",
        "id": {{String}},
        "messageDescription": {
            "topic": "CustomDomain",
            "action": "CancelDirective"
        }
    },
    "payload": {
        "directiveNamespace": {{String}},
        "directiveName": {{String}},
        "correlationToken": {{String}},
        "messageId": {{String}}        
    }
}

Payload

Property Type Required Description Example
directiveNamespace String Yes The namespace of the cancelled directive.
directiveName String Yes The name of the cancelled directive.
correlationToken String Yes The correlationToken of the cancelled directive.
messageId String Yes A unique ID used to identify a specific directive.

GetContext

Called to query the current custom states under given namespace from the device.

JSON Structure

{
    "header": {
        "version": "4.0",
        "messageType": "Publish",
        "id": {{String}},
        "messageDescription": {
            "topic": "CustomDomain",
            "action": "GetContext"
        }
    },
    "payload": {
        "contextNamespace": {{String}}        
    }
}

Payload

Property Type Required Description Example
contextNamespace String Yes The namespace of the queried context.

Incoming Messages

ReportDirectiveHandlingResult

Notifies the engine about the result of a directive handling.

JSON Structure

{
    "header": {
        "version": "4.0",
        "messageType": "Publish",
        "id": {{String}},
        "messageDescription": {
            "topic": "CustomDomain",
            "action": "ReportDirectiveHandlingResult"
        }
    },
    "payload": {
        "directiveNamespace": {{String}},
        "messageId": {{String}},
        "result": {{ResultType}}        
    }
}

Payload

Property Type Required Description Example
directiveNamespace String Yes The namespace of the custom directive.
messageId String Yes The messageId that uniquely identifies which directive this report is for.
result ResultType Yes The result of the handling.

SendEvent

Notifes the engine to send a custom event.

JSON Structure

{
    "header": {
        "version": "4.0",
        "messageType": "Publish",
        "id": {{String}},
        "messageDescription": {
            "topic": "CustomDomain",
            "action": "SendEvent"
        }
    },
    "payload": {
        "eventNamespace": {{String}},
        "eventName": {{String}},
        "eventPayload": {{String}},
        "requiresContext": {{Bool}},
        "correlationToken": {{String}},
        "customContext": {{String}}        
    }
}

Payload

Property Type Required Description Example
eventNamespace String Yes The namespace of the custom event to be sent.
eventName String Yes The name of the event.
eventPayload String Yes An opaque JSON payload in the format of escaped JSON string sent to the cloud with the event.
requiresContext Bool Yes A boolean indicating if this event must be sent with context.
correlationToken String No The token correlating this event to a directive. Required only if this event is sent as a response to a directive.
customContext String No The context corresponding to eventNamespace in a String representation of a valid JSON object (escaped). It's optional but recommended to provide the context with the event to reduce the amount of AASB message transactions. You can find the defined structure of context JSON in Custom Domain Platform Interface.

GetContextReply

Reply for GetContext message.

JSON Structure

{
    "header": {
        "version": "4.0",
        "messageType": "Reply",
        "id": {{String}},
        "messageDescription": {
            "topic": "CustomDomain",
            "action": "GetContext",
            "replyToId": {{String}}        
        }
    },
    "payload": {
        "customContext": {{String}}        
    }
}

Payload

Property Type Required Description Example
customContext String Yes The context for the queried namespace in a String representation of a valid JSON object (escaped). You can find the defined structure of context JSON in Custom Domain Platform Interface.

Enums

ResultType

Values

Value Description
"UNEXPECTED_INFORMATION_RECEIVED" The directive sent to your client was malformed or the payload does not conform to the directive specification.
"UNSUPPORTED_OPERATION" The operation specified by the namespace/name in the directive's header are not supported by the client.
"INTERNAL_ERROR" An error occurred while the device was handling the directive and the error does not fall into the specified categories.
"SUCCESS" The directive handling is successful.