How can I retrieve a draft post?
See original GitHub issueconst wp = new WP({
endpoint: endpoint,
username: username,
password: password
});
wp.posts().filter({status: 'any'}).embed().id(id).then(function(data) {
console.log(data)
})
When I try to retrieve an post that is set to draft, I’m unable to retrieve the post. When I log the error, i got a 403 permission error.
error:
{ [Error: cannot GET /wp-json/wp/v2/posts/631?_embed=true (403)]
status: 403,
text: '{"code":"rest_forbidden","message":"You don\'t have permission to do this.","data":{"status":403}}',
method: 'GET',
path: '/wp-json/wp/v2/posts/631?_embed=true' },
The user credential i sent to WP is a user with Admin privilege.
Thank you so much for your help!
Issue Analytics
- State:
- Created 8 years ago
- Comments:12
Top Results From Across the Web
I saved a draft post on my personal Facebook profile. Where is ...
To find this draft again, just create a post again by tapping on the “What's on your mind?” on your mobile device, and...
Read more >How to Find Facebook Drafts - Alphr
1. Sign in to your Facebook account. 2. Click on Pages in the navigation menu on the left side of your screen. This...
Read more >How To Find Drafts on Facebook App - Nerds Chalk
Inside the Posts & stories page, click on the Drafts tab at the top. You'll now see all the drafts you've saved on...
Read more >How to Find Drafts on Facebook? - Remote Tools
Scroll down to find the 'Posts & Stories' icon at the bottom and click on it. In the dropdown menu, select 'Drafts'. The...
Read more >Easy Ways to Find Saved Drafts on Facebook: 9 Steps - wikiHow
1. Go to https://facebook.com and log into your account. You'll need to use the desktop version of the site to find the link...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Figured it out. I have to chain
to the request!
Hi @kadamwhite, I am using this exact function chain
wp.posts().auth().param( 'context', 'edit' ).param( 'status', 'draft' )
to fetch drafts and I keep getting this error message:My auth works because I can create posts just fine AND I can see the drafts (that my user created), just fetching drafts is the issue.