New posts are disabled while we improve the user experience.

You can browse the site, or for urgent issues, raise a query at MyAccount.

question

Upvotes
Accepted
19.2k 86 39 63

The WebSocket API documentation test environment ignores "ServiceId"

I'm testing against an ADS that has multiple services available to request for market data using the WebSocket API. Logging in, requesting for data, etc, the API defines you can specify the "ServiceId". While I am able to do this programmatically, this capability doesn't seem to work when using the testing interfaces within the Developer Guide. For example, if I were to request for market data such as:

{
  "Id": 2,
  "ServiceId": 289,
  "Key": {
    "Name": "TRI.N"
  }
}

I can see my request apparently being sent within the Result window, however, when I get a response back, it is stating a different serviceId, the default one.

RECEIVED:
[
  {
    "Id": 2,
    "Type": "Refresh",
    "Key": {
      "ServiceId": 257,
      "Name": "TRI.N"
    },
  ...

]
elektron-sdktreprdp-apiwebsocketsrrtoService
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Upvotes
Accepted
361 1 4 3

@nick.zincone.1

The ServiceId should be in the Key of the request, e.g. try sending this:

{
  "Id": 2,
  "Key": {
    "Name": "TRI.N",
    "ServiceId",298
  }
}
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thanks Jim. Yes, I can see where I made my mistake - docs clearly show this field as part of the "Key" stanza.

Just a minor typo above; should be

"ServiceId":298

Took me a few moments before I realised why the request was not being sent....The joys of cut and paste!

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.