Message Structure
Requests
Each text request sent from the client to the server must conform to the following format:
{
"type": "request",
"requestId": "$requestId",
"method": "$methodType",
"restUri": "$uri",
"headers": {
"X-Voysis-Audio-Profile-Id": "$audioProfileId",
"X-Voysis-Ignore-Vad": false,
"Accept": "application/vnd.voysisquery.v1+json",
"Authorization": "Bearer 1.eyJpc3N1ZWRCeSI6IjBkZmI4OGMyLTQ2ZTctNGNjZC05YmZiLTQ3OTQ5NTJmN2I5YyIsImlzc3VlZEF0IjoiMjAxOC0wNC0yN1QwODo0NjozOS40NTRaIiwiZXhwaXJlc0F0IjoiMjAxOC0wNC0yN1QwOTowMTozOS40NTRaIiwiZ2VuZXJhdGlvbiI6MSwicGVybWlzc2lvbnMiOlsiY2VyYmVydXM6bGlvbmVsOmFjY2VzcyJdfQ==.53822ae0527256950896a36570797e3122a1b127e7c3ba85d648a7fce9cc36cd45fa829455579ad6c2ad5ec0ebf958d9bb1680a1e1b322357758c1a70e11b2e6"
},
"entity": "$entity"
}
typeis a fixed value and must berequest.requestIdis a unique per-session ID for the request message. This ID will be echoed back to the client in the response to allow request/response message correlation.methodis an HTTP verb describing the action to perform and is equivalent to the same verb used when accessing the equivalent REST endpoint. Must be a valid HTTP verb:GET,POST,DELETEet cetera.restUriis the relative URL of the equivalent REST endpoint being invoked. For example, when creating a new query, this would be the string/queries, or when accessing a particular query it might be the string/queries/a55197cb-f947-489a-8e4e-acb486871404.headersis an object containing the values for headers that would have been sent to the equivalent REST endpoint.entityis an optional entity, relevant only for certain HTTP verbs (such as POST, PUT and PATCH) that contains the content that would be sent in the body of an equivalent REST call.
Responses
Each text response sent from the server to the client will conform to the following format:
{
"type": "response",
"requestId": "$requestId",
"responseCode": "$responseCode",
"responseMessage": "$responseMessage",
"entity": "$entity"
}
typeis a fixed value and will beresponserequestIdindicated with request this response is for - it will be therequestIdfor the corresponding request.responseCodeis an integer value and will be the same as the HTTP response code that would be returned by the equivalent REST endpoint. 200 for successful GETs, for example, or 201 for a successful entity creation.responseMessageis an optional string that may or may not be present in the response. If present, it may provide further, natural language, details to complement the responseCode.entityis the content that would be returned by the equivalent REST endpoint.
Notifications
The server may proactively send a message to the client outside of a response to a request it has made. These message types are called notifications and will follow the following format:
{
"type": "notification",
"notificationType": "$notificationType",
"entity": "$entity"
}
typeis a fixed value and will benotification.notificationTypeis an enumerated value identifying the type of notification being delivered.entityis an optional, notification-specific, JSON data structure containing information relevant to the current notification.
Clients are not expected to provide any form of acknowledgement or response to notifications.
Updated over 7 years ago