Error Curl Amazon product API HTTP request

Hello everyone,
despite many attempts, I can’t switch my AMAZON product API curl to http request, I always get a 400 error.
Could you help me transform my Curl request into HTTP request please thanking you in advance
below is my Curl :

curl "https://webservices.amazon.fr/paapi5/getitems" \
-H "[Host: webservices.amazon.fr](https://)"  \
-H "Accept: application/json, text/javascript" \
-H "Accept-Language: en-US" \
-H "Content-Type: application/json; charset=UTF-8" \
-H "X-Amz-Date: 20220202T062956Z" \
-H "X-Amz-Target: com.amazon.paapi5.v1.ProductAdvertisingAPIv1.GetItems" \
-H "Content-Encoding: amz-1.0" \
-H "Authorization: AWS4-HMAC-SHA256 Credential=AKIAIGNHKA374NIEG5GA/20220202/eu-west-1/ProductAdvertisingAPI/aws4_request SignedHeaders=content-encoding;host;x-amz-date;x-amz-target  Signature=731ddb17873fdc9ac897ccacafc4379d0504a43a6702cc549af64d22aa5dac8c" \
-d "{
    \"ItemIds\": [
        \"B087YKWBWC\"
    ],
    \"Resources\": [
        \"Images.Primary.Large\",
        \"ItemInfo.Title\"
    ],
    \"PartnerTag\": \"galaxiegeek-21\",
    \"PartnerType\": \"Associates\",
    \"Marketplace\": \"www.amazon.fr\"
}"

below is my node:

{
  "name": "api amazon",
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        -400,
        60
      ]
    },
    {
      "parameters": {
        "requestMethod": "POST",
        "url": "https://webservices.amazon.fr/paapi5/getitems",
        "allowUnauthorizedCerts": true,
        "jsonParameters": true,
        "options": {
          "bodyContentType": "raw",
          "bodyContentCustomMimeType": "application/json"
        },
        "bodyParametersJson": "={{JSON.parse('{\"ItemType\\\":\\\"ASIN\\\",\\\"ItemIds\\\":\\\"B09KKN5PLC\\\",\\\"Resources\\\": \\\"Images.Primary.Large\\\",\\\"PartnerTag\\\":\\\"galaxiegeek-21\\\",\\\"PartnerType\\\":\\\"Associates\\\",\\\"Marketplace\\\":\\\"www.amazon.fr\\\"}')}}",
        "headerParametersJson": "={{JSON.parse('{\"Host\\\":\\\"webservices.amazon.fr\\\",\\\"Accept\\\":\\\"application/json, text/javascript\\\",\\\"Accept-Language\\\":\\\"en-US\\\",\\\"Content-Type\\\":\\\"application/json; charset=UTF-8\\\",\\\"X-Amz-Date\\\":\\\"20220202T052528Z\\\",\\\"X-Amz-Target\\\":\\\"com.amazon.paapi5.v1.ProductAdvertisingAPIv1.GetItems\\\",\\\"Content-Encoding\\\":\\\"amz-1.0\\\",\\\"kms\\\":\\\"CreateGrant\\\",\\\"Authorization\\\":\\\"AWS4-HMAC-SHA256 Credential=AKIAIGNHKA374NIEG5GA/20220202/eu-west-1/ProductAdvertisingAPI/aws4_request SignedHeaders=content-encoding;host;x-amz-date;x-amz-target Signature=84228fe833ec5eae13466b9a0c3c9b81eae7660acb732b801e3bf86bb9566419\\\"}')}}"
      },
      "name": "HTTP Request1",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        -220,
        60
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "timezone": "Indian/Reunion",
    "executionTimeout": -1,
    "errorWorkflow": "3"
  },
  "id": 3
}`

thanking you in advance
Running n8n via desktop app

Hi @dalleau974, welcome to the community :tada:

I’m sorry to hear you’re running into trouble here. I got a 400 response even for the curl request, so the n8n behaviour seems to be expected here.

Do you have some documentation on the API describing the exact request and the authentication method to be used?

hello thank you for your answer below the documentation for the api:

https://webservices.amazon.com/paapi5/documentation/sending-request.html

https://webservices.amazon.com/paapi5/documentation/common-request-parameters.html

https://webservices.amazon.com/paapi5/documentation/get-items.html

hoping this can help you, I can give you my access key and secret key identifier if you want

1 Like

https://webservices.amazon.com/paapi5/documentation/quick-start/using-sdk.html

I used the amazon scratchpad tool to get the request in Curl:
https://webservices.amazon.fr/paapi5/scratchpad/index.html

Here is the documentation regarding the signature:

Hi @dalleau974,

I was taking a closer look into your request Error Curl Amazon product API HTTP request - #3 by dalleau974 today. I did sign up for Amazon’s Associates program, but it looks like they wouldn’t grant me any access to the Product Advertising API before selling at least 3 items.

From looking at the documentation you have shared, it seems Amazon includes the current time in their signature logic, meaning the curl requests will most likely expire and can’t be used continuously in n8n’s HTTP Request node.

So my suggestion would be to raise a feature request in order to get a proper integration to this API.

You might still be able to connect to it manually, but this would require emulating the entire logic of the “Without SDK” part of Amazon’s Partner API documentation at which stage it might be easier building a custom n8n version including an npm package like this to be used in a Function node later on.

Either way, this seems to be a lot of work and is unfortunately not something I can provide much help with. Maybe another community member has some more useful feedback here, let’s see.

Hello, how I can know if N8N is working on that Amazon API node? I’m very interested also to connect to that API.

Hi @Nelson_Paz_y_Mino, I don’t think there is any node planned for this API specifically I am afraid. So, you might want to raise a new feature request for this.