Hi – for some reason, I’m not able to make an anonymous post through the API in JavaScript. This is through an app (the Obsidian plugin I’m working on), so don’t know if that makes a difference.
Here’s the code:
const postData = { // all 3 are strings
body: currentText,
title: postTitle,
font: settings.postType
}
const uploadResponse = await fetch('https://write.as/api/posts', {
method: 'POST',
mode: "no-cors",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(postData) // this appears valid, at least from console output...
}
);
I have to do no-cors
or else I get an error, possibly related to the headers the API server is returning? Not sure.
But with the above code, I instead get 400 (Bad Request)
without any further details.
Any ideas what’s going on?
@support