question

newuser-f2e8c561-0e3e-4d53-a31c-1053867380a3 avatar image

Problem with Replenishment Request

When I send a request for replenishment endpoint, I have encountered below problem on browser console side. How can I solve this problem?

Problem:

Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource .Origin 'https://mywebsite.com' is therefore not allowed access. The response had HTTP status code 404.

Request:

var xhr = new XMLHttpRequest(); xhr.addEventListener("readystatechange", function() { if (this.readyState === 4) { console.log("responseText:" + this.responseText); } });

var slot_id = "xxxxxxxxxx";

xhr.open("POST", "https://dash-replenishment-service-na.amazon.com/replenish/" + slot_id, true); xhr.setRequestHeader("Authorization", "Bearer (" + access_token+")"); xhr.setRequestHeader("x-amzn-type-version", "com.amazon.dash.replenishment.DrsReplenishInput@1.0");

xhr.setRequestHeader("x-amzn-accept-type", "com.amazon.dash.replenishment.DrsReplenishResult@1.0");

xhr.send();

Thanks,

Gizem.

apiamazon developer portaldash replenishment service
10 |5000

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

1 Answer

Levon@Amazon avatar image
Levon@Amazon answered

Hi Gizem,

Thanks for posting! It looks like the browser is blocking your request due to cross-site scripting. Does the request work when you make the call from your app or device? Thanks!

10 |5000

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