Error 415 when posting to /login

A place for developers to advertise their TheTVDB.com enabled app and get help from other developers with the API.
Assyrial
Posts: 1
Joined: Fri Oct 05, 2018 2:50 pm

Error 415 when posting to /login

Postby Assyrial » Fri Oct 05, 2018 2:56 pm

Hi guys,

I'm making this side project but i'm getting this 'error 415 unsupported media type' everytime i post to https://api.thetvdb.com/login. I'm using fetch to post to it. My code:


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

let myInit = { method: 'POST',
headers: myHeaders,
mode: 'no-cors',
body: JSON.stringify({
"apikey":"My_API_Key",
"username":"My_Username",
"userkey":"My_Userkey"
})
};

let myRequest = new Request('https://api.thetvdb.com/login', myInit);

fetch(myRequest).then(function(response) {
console.log(response);
}).catch(err=>console.error(err))

Any of you had this problem or know what i'm doing wrong?