Last update | Dec 2023 |
Environment | Any |
Language | Any HTTP is supported |
Compilers | None |
Prerequisites | DSS login, internet access |
Source code | Below |
This tutorial explains how to request an authentication token from the server.
This is the starting point and a pre-requisite for all the other tutorials.
It also illustrates how to get user information using the token, which is a way to test if it is still valid.
A Postman collection and environment are available in the downloads, but you can also enter HTTP requests manually.
The LSEG Tick History REST API requires a valid DSS username and password in order to access any of the API capabilities. These username and password will be provided to LSEG Tick History customers and are valid both in the API and the GUI.
The DSS username and password are used to request an authentication token. The received token must be cached, and attached to all following requests to the server.
The tokens are valid for 24 hours, after which a 401 (Unauthorized, Authentication Required) status code is returned. At that point a new token must be requested.
Note: you must provide valid DSS credentials (username and password) in the body of the request.
URL:
https://selectapi.datascope.refinitiv.com/RestApi/v1/Authentication/RequestToken
Method: POST
Headers:
Prefer: respond-async
Content-Type: application/json
Body:
{
"Credentials": {
"Username": "33314",
"Password": "XXXXXXX"
}
}
Content-Type: application/json; charset=utf-8
The content is in JSON (JavaScript Object Notation) format.
Body:
{
"@odata.context": "https://selectapi.datascope.refinitiv.com/RestApi/v1/$metadata#Edm.String",
"value": "A6C451842A8FF72ECFB75DFF63AD8D03FE3D486FD1EB8EE48B296A8D469BE732DAA16356CF75BC0E349456694DAB3C650AB199C66C46016D33D5AAB1B4E44D22AD14905DAF573D21BFA771CCA58DAA63C1EF71BB488D768988A65E6A47B0F797F9DFCE8DCBBD516BAD8C33C6C629CD5B3B276D4D4A8C89ABD0A318F2B3893ED0C160B2E831A673D1AA8BA3EDE1945BA0083DADBF548EA8644CD01831AE3F5F27CF7AE06D2614792178723E005CE5DDABB4C9E6DD247B17A1775C418A009005DFF417EB2729CC61FF4021C147D9ED976A6FF02F8931F2B75ED8BCED3B1D182450"
}
The returned value is the token.
Notes:
Let us make a request for user information. Making a simple request allows us to test the validity of a token.
URL:
https://selectapi.datascope.refinitiv.com/RestApi/v1/Users/Users(33314)
Method: GET
Headers:
Prefer: respond-async
Content-Type: application/json
Authorization: Token A6C451842A8FF72ECFB75DFF63AD8D03FE3D486FD1EB8EE48B296A8D469BE732DAA16356CF75BC0E349456694DAB3C650AB199C66C46016D33D5AAB1B4E44D22AD14905DAF573D21BFA771CCA58DAA63C1EF71BB488D768988A65E6A47B0F797F9DFCE8DCBBD516BAD8C33C6C629CD5B3B276D4D4A8C89ABD0A318F2B3893ED0C160B2E831A673D1AA8BA3EDE1945BA0083DADBF548EA8644CD01831AE3F5F27CF7AE06D2614792178723E005CE5DDABB4C9E6DD247B17A1775C418A009005DFF417EB2729CC61FF4021C147D9ED976A6FF02F8931F2B75ED8BCED3B1D182450
Content-Type: application/json; charset=utf-8
Body:
{
"@odata.context": "https://selectapi.datascope.refinitiv.com/RestApi/v1/$metadata#Users/$entity",
"UserId": 33314,
"UserName": "Firstname Lastname",
"Email": "firstname.lastname@domain.com",
"Phone": "xxx-xxx-xxxx"
}
If the token is not valid, or has expired, a 401 (Unauthorized, Authentication Required) status code is returned.