API Connection Report data and Market data

Created by Elin Stenrud, Modified on Tue, 8 Oct at 12:26 PM by Elin Stenrud

Introduction 

Welcome to the documentation for our Report Data API. This API provides endpoints for users or other data-centers to access a certain set of data that derives from a Treasury Systems report. This API will fetch a snapshot of how that specified report looked on a given day. The Report is managed and edited in Treasury Systems. 

 

Get Started 

To get started using the API, follow these steps: 

Sign Up 

A user must within Treasury Systems, with the permissions to edit and create new users, setup a new user in the Permissions & Roles view. Once the user is created, the creating user must assign the newly created user with the permission Public API Access. When creating the user, the user needs to have the same Name in Treasury Systems as the user ID when requesting from the API. 
 
Example: If the request authentication has the user ID customer@company.com, the same Name needs to be the same in Treasury Systems. 

 

There is a second way to create an account, and that is to call the API before creating the user, prompting the system to create a user. A Treasury Systems user with the proper permissions must then login to Treasury Systems and assign the newly created user it’s permission before the API will accept any requests. 

 

Examples for Python with Office 365 SSO

Download the attched file reportdata.ipynb

Import to your jupyter notebook update url with your customer name (domain)


Authentication 

This API uses JWT bearer tokens as it’s authentication. As explained previously, the token needs to match the Name in Treasury Systems to grant access to any requests. 

Postman

Add a application and create a token see article API authentification create application and token (Postman)


Using Excel and login in with organization account 

This option is only possible if the company uses Microsoft Entra Id.

First add the permission “Public API Access” to the user in the TS Application 

Open Excel choose Data => From Web 

Enter the URL for the data you want to fetch e.g. 

Chose Organization account  

 

 


 

Report data Base URL 

The base URL for report endpoints is: https:// [COMPANY].treasurysystems.com/api/reportdata/ 

 

Error Handling 

Errors are handled internally and are logged internally. If any errors do occur during use, please contact TS support for further assistance. Any error is returned as status code 500. 
 

Rate Limiting 

Our API adapts a simple rate limiting policy. Currently the rate limit is 10 requests per minute. 
  

Endpoints 

/atdate/ 
 
Description: This endpoint is the most basic one of the report data endpoints. It will fetch and return a single dataset that’s been saved and created on the specified date. 

Parameters: 

param1 (string): This is the one and only parameter for this endpoint. This parameter specifies the dataset at the date that you wish to fetch. The date is a date code, which are commonplace in Treasury Systems environment. At the end of this documentation we provide a list of the date codes available. The parameter name is “dateCode”. 
 

/realtime/ 

Description: This endpoint returns a data set as it is now. That means that Treasury Systems will run the specified report at real time and return its data. If anything is changed in the system and this is requested again in the same day, you might receive differing datasets. 

Parameters: 

This endpoint has no parameters. 

 

/daterange/ 

Description: The last endpoint works like the atdate endpoint, but has 2 parameters. It fetches every dataset between two date codes. Returns it as a JSON collection.  

Parameters:  

param1 (string): The first parameter has the name “fromDateCode”. The codes that this endpoint accepts are in the end of this document. This date code is the start in the date range. 

param2 (string): The first parameter has the name “toDateCode”. The codes that this endpoint accepts are in the end of this document. This date code is the end of the date range. 

Example: 
 
{ 

    "param1": "20240301", 

    "param2": "20240401" 

} 

This will return datasets from the 1st of march to the first of April. 

 

API Version 

Our API has versioning. When using any of the endpoints, the version needs to be specified. In order to specify version, simply add /v{version number} on the end of the URL. The current versions that are currently live are listed below. 

Example:  https:// [COMPANY].treasurysystems.com/api/reportdata/realtime/v1 
 

Versions 

  • Realtime 

  • v1 - first implementation of endpoint. 

  • Atdate 

  • v1 - first implementation of endpoint. 

  • Daterange 

  • v1 - first implementation of endpoint. 

 

Market Data API URL 

The base URL for this endpoint is: https:// [COMPANY].treasurysystems.com/api/marketdata/ 

Endpoints 

/fx/ 
 
Description: This endpoint gets FX rates at the given date. It will return a JSON containing the Time the rate is valid at, the base currency and the price currency,  the periods that the rates are valid at and lastly the Bid rate, Ask Rate and FWD points. 

Parameters: 

param1 (string): This endpoint accepts one parameter. It’s a string called “dateCode”. It functions as the other date code parameters in this document. At the end of this documentation we provide a list of the date codes available. 
 

/ir/ 

Description: Similarly to the FX endpoint, this will return rates but for interest. It will return a JSON containing a collection of interest rates.  

Parameters: 

param1 (string): Accepts the same parameter as the FX endpoint. It’s also called “dateCode”. It functions as the other date code parameters in this document. At the end of this documentation we provide a list of the date codes available. 
 

Response Codes 

200 OK - Request successful. 

204 No Content – There was no datasets to return. 

400 Bad Request - Invalid request. 

401 Unauthorized - Authentication failure. 

404 Not Found - Resource not found. 

405 Parameters not correct entered

500 Internal Server Error - Something went wrong on the server. 

 

Date Codes 

The date codes that can be used are listed below. Generally these codes are such as “20240101”, which represents 2024-01-01, or “today” which simply will be translated to the date of when the request was sent. 

The most common date codes are listed below: 

  • TODAY – Picks the current date 

  • D – One day, so the next day 

  • BD – Next business day 

  • W – Week from now 

  • M – Month from now 

  • Q – Quarter from now 

  • Y – Year from now 

  • Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday – The next given day 

  • Date codes can used mathematically as -1D or -1W.  This works by combining a operator (+ or -), the amount and the date code. Example: -5W would result in 28 days backwards. -7BD would be 7 business days backwards (this takes holidays into account as well). 

  • Lastly a user can enter a “texted date” as mentioned above, such as “20240101”.  

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article