Using the Wordpress REST API I am trying to get draft posts only. However the API responds with only the published posts when I pass the query in both cases.
A: http://localhost/wp-json/wp/v2/posts?status=draft
B: http://localhost/wp-json/wp/v2/posts?filter[post_status]=draft
How can I see only the draft posts? I am using the JWT Authentication for WP-API plugin for authentication but disabling this doesn't seem to change anything.
This is because just installing the JWT Auth plugin doesn't solve the problem. There are also some modifications to be performed on the .htaccess file as well as in wp-config.php.
I hit a similar problem but with private posts, so I created a video detailing the steps you need to follow to install and configure the JWT Authentication plugin.
https://youtu.be/Mp7T7x1oxDk
for getting draft posts you should send an Authorization token, so you can use
JWT Authentication for WP-API plugin for getting it and use it anywhere,
and for getting posts with drafts status you should send 'status': 'draft' as a param in your request, also if you want to get all of status you should send 'status': 'any' in your params in request. :)
Related
We are using WP JWT Auth plugin to login user to WordPress from wp rest API. WP JWT Auth plugin requires a password to get the token, now when we are integrating facebook login, I am not sure how to get the user logged in since we won't be having passwords from facebook.
Any suggestions?
Yesterday I opened a bounty for your question and today I'm answering it!
You will need two WordPress plugins: stionic users and nextend social login (you need to configure it on order for stionic to work. Watch the video on that page in order to know how to configure it)
When done you could send a post request to https://example.com/wp-json/wp/v2/m_facebook/loginin postman and you will notice that you will get the same token that you get when logging in https://example.com/wp-json/jwt-auth/v1/token
After that, you can configure facebook ionic plugin and you are done.
JSON API User plugin is an alternative but I haven't tried it
Useful tutorials
Facebook ionic login - Wordpress ionic login
I am trying to integrate PayuMoney payment gateway into my Meteor App. The process involves sending a POST request to a external url(payu url) and also redirecting the user to it. The user completes the payment on PayUmoney's site and once done, the PayUmoney site redirects back to a url(provided by me) with parameters passed as POST.
What I have done currently,
To post the form, I have allowed the default behavior of the form. I have defined the method as POST, with the target URL and all input parameters as hidden.
However, I am unsure on how to accept the variables after the tranasaction. I tried this method: How do I access HTTP POST data from meteor? but, this didn't work.
Technical Integration Document (Pay U Money): https://s3.amazonaws.com/uploads.uservoice.com/assets/074/080/407/original/PayUMoney_Technical_Integration_Document.pdf?AWSAccessKeyId=AKIAJF4UXUF6KJMEJFQQ&Expires=1519543396&Signature=ASnFquJkmCwQSMfx93w913MjZPk%3D
Any help will be appreciated. Thanks!
Assuming you're talking about accepting the response from PayUMoney, meteorhacks:picker is a great library for setting up an API. If you follow along with this guide, you'll get taken through all the steps of setting an endpoint up that can accept a cross-origin POST request.
I’ve been trouble shooting this all weekend and not finding any solutions. I’m trying to setup webhooks for Mailchimp and CiviCRM 4.6.1 through Wordpress 4.3.1.
The mailchimp settings panel in CiviCRM provides the web hook address as:
Webhook URL - http://<domain>/?page=CiviCRM&q=civicrm/mailchimp/webhook&reset=1&key=2345
Anytime I request the url in a browser window it returns a ‘null’ response. When I paste it into the Mailchimp webhook setup Mailchimp gives me a 403 error (“We couldn't verify the URL is working. Please double check and try again. HTTP Code: 403”).
I’ve tried to ensure that step 3 of the Veda Consulting instructions https://github.com/veda-consulting/uk.co.vedaconsulting.mailchimp was handled:
Make sure webhook url is accessible to public. If not, just make sure anonymous / public user has “allow webhook posts” permission.
but in wordpress settings (https://en.support.wordpress.com/webhooks/#what-would-i-use-something-like-this-for) I can’t find a webhook tool. Am I missing something? Is this from an older version of wordpress. I found the Hookpress plugin but it has a warning that it hasn’t been tested with the current version of wordpress.
Whoever can tell me how to get this webhook working for Mailchimp I would greatly appreciate it, thanks!
It's a civiCRM setting, not a Wordpress setting.
This comment from the developer reveals a URL to use to expose the permissions panel:
You can enable 'allow webhook posts' permission in wordpress access control by navigating to
http:///wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fadmin%2Faccess%2Fwp-permissions&reset=1
Reference: https://github.com/veda-consulting/uk.co.vedaconsulting.mailchimp/issues/172#issuecomment-162478431
Not a totally satisfying answer but I ran my webhook link through firebug and it always returns an ok 200 response from the server.
I corresponded with Mailchimp and they confirmed that from what they can see there isn't an issue with the webhook I'm using. They suggested I whitelist their API's IP addresses but my hosting doesn't allow whitelist IPs. I've gone back to Mailchimp but it's looking like the fate is sealed on this one.
If not, just make sure anonymous / public user has “allow webhook posts” permission.
This refers to permissions configuration in your CMS.
In Drupal and Backdrop, this is configured under Admin > People > Permissions (admin/people/permissions) where you must grant "allow webhook posts" permission to the "anonymous user" role.
In WordPress, a similar pattern should allow you to grant the "allow webhook posts" capability to the "Anonymous User" role.
In Joomla, I think the Veda MailChimp plugin doesn't check permissions on that webhook callback.
I had to debug a site which hadn't had this configuration set today, and the HTTP response code for the callback to MailChimp was 500 when permission not granted, and 200 when it was granted. That might help debug your own situation (you should be able to duplicate this simply by GET to the webhook callback).
I have a wordpress page from which I am trying to create a post using the WP AJAX REST API. My expectation is that if the user is already logged in the auth cookie will be in place and I'll be able to do the AJAX POST with the user's context. Yet I'm getting an error that the user is not authorized. What am I missing? Thanks
This plugin is not kept up to date but adding a new post should work as follows:
Go to the settings -> json api and activate posts controller
get nonce
http://www.example.com/?json=core.get_nonce&controller=posts&method=create_post&callback=?
Grab the nonce from the reponse, Response should be:
?({"status":"ok","controller":"posts","method":"create_post","nonce":"38nonce84"})
4.Post a post
www.example.com/?json=posts.create_post&nonce=383nonce84&title=newpost&content=blahblabh&status=publish
I have a WP multisite installation with various users each having their own installation
Ie
www.mysite.com/fearghal
www.mysite.com/john
etc.
Is there a way I can use one Twitter application that will allow each user to update their status? I know with one site it is simple, but with multiple url's like WP MS - could be tricky with various callback urls.
Any ideas folks?
You can do that. When you get a request token you will have to pass the callback url for that site to Twitter and callback URL will have a verifier passed to it that will need to be sent when you get an access token. You can read more about the process at http://dev.twitter.com/pages/auth