If you don’t mind me asking. what REST API are you calling, and can you provide a code example? This seems like it should be dirt simple but there are undocumented required fields for the draft-post API. I’d like to get something/anything to work at this point. But this just throws a 500 error.
import wixSecretsBackend from 'wix-secrets-backend';
import {fetch} from 'wix-fetch';
export function addOOS(){
wixSecretsBackend.getSecret("ManagerOOSPosts")
.then ((mySecret) => {
const fetchOptions = {
method: 'post',
headers: {
'content-type': 'application/json',
'Authorization': mySecret,
'wix-account-id': '3ce23514-62b3-4167-a04a-ad0b131b09e9',
'wix-site-id': 'cdf3c1b4-d8d7-45c0-9c7d-d29b1e7040a8'
},
body: JSON.stringify({
'draftPost': {'title': 'Order of Service - Draft'},
'publish': false,
'fieldsets': [],
'fieldMask': []
})
}
fetch('https://www.wixapis.com/blog/v3/draft-posts', fetchOptions)
.then( (httpResponse) => {
console.log(httpResponse);
})
})
}