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"
}
  • type is a fixed value and must be request.
  • requestId is 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.
  • method is 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, DELETE et cetera.
  • restUri is 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.
  • headers is an object containing the values for headers that would have been sent to the equivalent REST endpoint.
  • entity is 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"
}
  • type is a fixed value and will be response
  • requestId indicated with request this response is for - it will be the requestId for the corresponding request.
  • responseCode is 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.
  • responseMessage is 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.
  • entity is 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"
}
  • type is a fixed value and will be notification.
  • notificationType is an enumerated value identifying the type of notification being delivered.
  • entity is 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.