Community Discussion

Ask a Question
Back to All

Recommendations API blocked by CORS


I am tring to implement the recommendations API request on my application (

The problem is when i use fetch browser API it will be blocked by CORS policy.

Following an example that works with Postman but not on Chrome.

const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

const raw = JSON.stringify({
"placements": [
"name": "Placement-1-1",
"recCount": 1,
"organicType": "mix",
"thumbnail": {
"width": 300,
"height": 200
"user": {
"session": "init",
"device": "5bfebde9-c03c-47cd-8f04-2dbe1179b44d",
"languages": [
"app": {
"type": "DESKTOP",
"apiKey": "xxxxxxxxxxxxxxxx",
"name": "test",
"origin": "CLIENT"
"view": {
"id": "e8a42862-7437-4b36-826a-9aeb6d8ce5a3"
"source": {
"type": "HOME",
"id": "/test_sw.html",
"url": "http://localhost:8004/test_sw.html"

const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow"

fetch("", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));

Is there a way to bypass the CORS check?