POST API call returning 405
Unanswered
Forster's Tern posted this in #help-forum
Forster's TernOP
var body = {
username: "a@b.com",
password: "abc"
};
var res = await fetch("https://MY_DOMAIN.COM/api/user/login", {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body)
});
if (!res.ok) {
throw new Error('Failed to fetch data')
}
return res.json();
username: "a@b.com",
password: "abc"
};
var res = await fetch("https://MY_DOMAIN.COM/api/user/login", {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body)
});
if (!res.ok) {
throw new Error('Failed to fetch data')
}
return res.json();
1 Reply
@Forster's Tern var body = {
username: "a@b.com",
password: "abc"
};
var res = await fetch("https://MY_DOMAIN.COM/api/user/login", {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body)
});
if (!res.ok) {
throw new Error('Failed to fetch data')
}
return res.json();
which mean
https://my_domain.com/api/user/login doesn't allow post request