@MLFromScratch the Content API is a public API and therefore unpublished posts are not available, otherwise anyone viewing a Content API powered site could read all of your drafts.
What is the use-case for fetching an unpublished post? If this is server-side you can use the Admin API to fetch all posts both published and unpublished.
I’m making a post on IBM as a contractor - and they basically just need the HTML to publish it. I’m curious if there is a better way to deliver the article to them, than going through the admin API though.
This makes a lot of sense. I was just not aware of the admin API, so I will make a small script to solve this. Thank you for your help Kevin!
Hmm, if you wanted to avoid a script there are a couple of options.
Open the post preview and copy/paste the relevant html section
Have web inspector open when opening a post in the editor, find the network request which loads the post, right-click and choose “Copy as fetch” then switch to the Console tab and paste. Before hitting Enter you’ll want to add the ?formats=html query param and add .then(response => response.json()).then(console.log) to the end of the statement. A little long-winded but saves writing a script or getting admin api credentials for one-off things :)