Skip to main content
Solved

REST API with hashed "Accesstoken"

  • November 18, 2025
  • 3 replies
  • 29 views

Forum|alt.badge.img

I need to connect some new REST API's to our TX environment. These API's where easy to configure in Postman, but is now a challenge in TX. In Postman it's possible to use a “pre-script” (java) to create some variables, concatenate them and then hash. 

This is the script:

const method = 'GET';
const urlPath = '/app/openapi/v1/device/deviceOpenIds';
const secret = 'MY_SECRET';
const timestamp = Date.now().toString();

const signature = CryptoJS.HmacSHA256(method + timestamp + urlPath, secret).toString(CryptoJS.enc.Hex);

pm.environment.set('timestamp', timestamp);
pm.environment.set('signature', signature);

This signature is used in the header for authentication for the GET call. The API provider gives a python or java script to make the HmacSHA256 hash, but I cannot use that directly in TX.

What is a good way to approach this in TimeXtender? 

Best answer by rory.smith

Hi,

if you have a reachable SQL Server you should be able to create a UDF there like: https://gist.github.com/rmalayter/3130462 (hex output)

This can then be called from Dynamic Values in an endpoint for instance.

 

3 replies

rory.smith
TimeXtender Xpert
Forum|alt.badge.img+8
  • TimeXtender Xpert
  • Answer
  • November 24, 2025

Hi,

if you have a reachable SQL Server you should be able to create a UDF there like: https://gist.github.com/rmalayter/3130462 (hex output)

This can then be called from Dynamic Values in an endpoint for instance.

 


Forum|alt.badge.img

Hi Rory,

Think this would work.

But currently I found another (more complex) solution. In this workaround I don't use an UDF.

I make use of a Fabric Notebook to execute the python script, which writes it's result in a Lakehouse table. This is scheduled daily as tokens are valid for 24 hours. 

TimeXtender extracts the SQL table towards the Ingest+Prepare layer.

My API can retreive the hashed signature from the Prepare layer to use the retreived value in it's call for data, using Dynamic Values in the REST connector.

This is a working solution. I will see if I can try your suggestion and post my feedback.


Forum|alt.badge.img

Hi Rory,

I did some tests and it works great now.

Advantages above the (also working) Fabric solution:

  • Don't need to store sensitive in between information
  • Less steps
  • Simply check the “sensitive” box in TX to hide sensitive information instead of collecting it from Azure Key Vault.

I just deleted my lakehouse and notebooks. Thanks!

KR,

Juriaan