​Just wonder, if the authentication is done via OAuth v1 like this page mentioned - https://githu...

...b.com/scalaj/scalaj-http Or it is a custom authentication method that Reuters custom build? Product TRTHv2 API

Just wonder, if the authentication is done via OAuth v1 like
this page mentioned - https://github.com/scalaj/scalaj-http

Or it is a custom authentication method that Reuters custom
build?

Product TRTHv2 API

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    TRTH V2 REST API uses token based authentication.

    First, to get a token, the application need to send HTTP POST to https://hosted.datascopeapi.reuters.com/RestApi/v1/Authentication/RequestToken with Username and Password in the body.

    image

    If the credential is valid, the application will receive HTTP Response with status 200 OK and a token in the body.

    image

    Next, this token will be added in the HTTP header for subsequent requests. For example:

    Headers:

    Prefer: respond-async
    Content-Type: application/json
    Authorization: Token F0ABE9A3FFF2E02E10AE2765ED872C59B8CC3B40EBB61B30E295E71DE31C254B8648DB9434C2DF9299FDC668AA123501F322D99D45C8B93438063C912BC936C7B87062B0CF812138863F5D836A7B31A32DCA67EF07B3B50B2FC4978DF6F76784FDF35FCB523A8430DA93613BC5730CDC310D4D241718F9FC3F2E55465A24957CC287BDEC79046B31AD642606275AEAD76318CB221BD843348E1483670DA13968D8A242AAFCF9E13E23240C905AE46DED9EDCA9BB316B4C5C767B18DB2EA7ADD100817ADF059D01394BC6375BECAF6138C25DBA57577F0061

    The token remains valid for 24 hours. You can reuse a token as often as you like within that 24-hour period. For more information, please refer to REST API Tutorial 1: Connecting to the server.

Answers

  • To add, once you get the authentication token you can set it using the following:

    Http(requestUrl)
    .headers(requestHeaders)
    .postData(reqJson)