question

Upvotes
Accepted
1 1 1 2

C# Which code sample allows me to apply a json parameter file for TRKD (attached)

requestjson.txt

rkd-apirkdc#
requestjson.txt (309 B)
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

Upvotes
Accepted
206 1 2 2

The support portal code samples are designed around importing a WSDL and allowing .NET to build proxy classes and give you a more functional approach to using TRKD API than having to post raw text, either xml or json.

I'm not aware of one showing sending just a plain old text file.

If you do prefer to build the requests yourself and simply POST them, then in support portal I suggest go to the operation you want, click on JSON and goto "Load From..." and import the text file you attached (that will prove the syntax of the request is ok if it loads it).

Then click on "Inspect" ... that will show you the url and headers you'll need to send along with the request body.

In your case the url is http://api.trkd.thomsonreuters.com/api/Search/Search.svc/REST/EquityQuote_1/GetEquityQuote_1 and only 2 headers (as for all use in JSON mode). Obviously you would replace the token by your dynamically created one.

To do the actual POSTing I would suggest HttpWebRequest object in System.Net namespace, it has help here: https://msdn.microsoft.com/en-us/library/system.net.httpwebrequest(v=vs.110).aspx

That will then give you the response object and feed that into some JSON parser of your choice to handle the response.

In the downloads section of support portal there are also code sample for other languages that might give some help on the mechanics of use various http request objects (in their respective languages--but the mechanics are all the same as its all based on http). I just checked some of them and they tend to all import WSDLs also.

Remember that the token creation has to use https. Do the same approach to see its json url and request (no headers this time):

https://www.trkd.thomsonreuters.com/SupportSite/TestApi/Op?svc=TokenManagement_1&op=CreateServiceToken_1

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.