question

Upvotes
Accepted
9 1 0 3

DSWS Failed to decode token. Invalid length for a Base-64

Hello


I get my token

curl --location --request GET 'https://product.datastream.com/DSWSClient/V1/DSService.svc/rest/Token?username=ZHTXXX&password=XXXXXX'

Rhis gives me a token.

But when I do a getData request

Here is my call

curl --location --request GET 'https://product.datastream.com/DSWSClient/V1/DSService.svc/rest/Data?token=fMSwrVbhK3sPtofO0a5fIY4mQAO9XUu22EqXE7gEMIDj1cP3zi2G4s6wUUQSkX8MySi+OQAHBQYTN91uob0zGL559Dw9uTwjS1p1qYSa2FpCAYPuPL7VSJkyiOCZRHmzYOQuaVBH4y5kl8lUbaRDqTQKvzxb/9wdC9ZL112zz9bar1fjeu+UU82jiauZocQh6Mmy7KZmFFWlaiMT9IUA13tSR4JK6dwT3MliJ6xl7Bg=5894E718FFxxxx&instrument=VOD&datatypes=PL%2cPH&datekind=TimeSeries&start=-30D&end=-20D&freq=D'


I always have this error


{

"Code": "InvalidToken", "Message": "Failed to decode token. Invalid length for a Base-64 char array or string. (Token: fMSwrVbhK3sPtofO0a5fIY4mQAO9XUu22EqXE7gEMIDj1cP3zi2G4s6wUUQSkX8MySi OQAHBQYTN91uob0zGL559Dw9uTwjS1p1qYSa2FpCAYPuPL7VSJkyiOCZRHmzYOQuaVBH4y5kl8lUbaRDqTQKvzxb/9wdC9ZL112zz9bar1fjeu UU82jiauZocQh6Mmy7KZmFFWlaiMT9IUA13tSR4JK6dwT3MliJ6xl7Bg=5894E718xxxxx)", "SubCode": null}


In the 'documentation' there is nothing written on additional headers


Please help

datastream-apidsws-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

1 Answer

Upvote
Accepted
38.1k 71 35 53

@germain.garnier

The token must be URL encoded. For example, '+' must be changed to '%2b' and '/' must be changed to '%2f'.

You can refer to this website regarding URL encoded.

fMSwrVbhK3sPtofO0a5fIY4mQAO9XUu22EqXE7gEMIDj1cP3zi2G4s6wUUQSkX8MySi%2bOQ...


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea