question

Upvotes
Accepted
1 1 1 3

AWS download - X-Direct-Download returns Invalid Argment error : 400 Bad Request

Hello,

I am trying to make TRTH AWS download feature, by using X-Direct-Download header.

With Postman, I could see the tick data actually can be downloaded, then I added

X-Direct-Download header,then, However I am getting below error, Could you advise how I can fix the problem?

<Error>
<Code>InvalidArgument</Code>
<Message>Only one auth mechanism allowed; only the X-Amz-Algorithm query parameter, Signature query string parameter or the Authorization header should be specified</Message>

@Noboru.Maruyama

tick-history-rest-apiaws
icon clock
10 |1500

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

1 Answer

· Write an Answer
Upvotes
Accepted
11.3k 25 9 14

Hi @Noboru.Maruyama

The message will be received, once HTTP client has redirected to AWS with all headers of the original request including the "Authorization" header. Amazon interprets this token as an Amazon token, causing the request to fail. This is described in this advisory.

To avoid this issue, you configure your HTTP client to disable automatic redirection and then manually do redirection.

Example for Curl command,

1) Get redirect URL, and then store it in an environment variable.

redirect_url="$(curl -I -Ls -H 'Authorization:
Token_xxxxxxxxxxxxxxxxxxxxx' -H 'X-Direct-Download:true'  -X
GET  https://hosted.datascopeapi.reuters.com/RestApi/v1/StandardExtractions/UserPackageDeliveries%28%27<UserPackageDeliveriesID>%27%29/%24value
-o /dev/null -w %{url_effective})"

    2) Directly download a VBD file from the redirect URL.

    curl -k -X GET $redirect_url -o output.gz
    icon clock
    10 |1500

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

    Hello @veerapath.rungruengrayubku

    You gave me perfect answer, I could fix the problem!

    Thank you very much!

    Best regards

    Noboru Maruyama

    Write an Answer

    Hint: Notify or tag a user in this post by typing @username.

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