Skip to content

IS 04 Client

Gareth Sylvester-Bradley edited this page May 12, 2022 · 4 revisions

Please refer to the Generic API Client page as a starting point before considering the specifics below.

Further documentation for WebSocket communication is available here.

Basic Guide

  1. Discover an appropriate Query API using DNS Service Discovery.
  2. Select the maximum API version from those supported by the Query API which your client also supports.
  3. Issue a POST request to the /subscriptions resource of the Query API, including any basic or advanced query parameters to restrict the returned resources using the 'params' object.
  4. Connect to the WebSocket returned by the API, and populate your interface using the initial sync message.
  5. Update your interface's contents as changes arrive via the WebSocket channel.

Best Practice

  • Make use of the Query API downgrade queries mechanism wherever possible. This ensures that you can display Nodes and their resources via your user interface, even if they only support a lower version of the API specifications. See Requirements for Query API Clients for more information.
  • Use basic queries (and advanced query language where available) to cut down on the volume of resources returned to your client.
  • Observe and interpret all of the TXT records returned with the DNS Service Discovery responses. These indicate the preferred API instance to use (via 'pri'), the API versions supported (via 'api_ver') and the protocol supported (via 'api_proto').
  • If all available Query APIs return errors, use an exponential backoff algorithm when retrying until a success code is returned.