-
Notifications
You must be signed in to change notification settings - Fork 13
Cannot Create Post. #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi,
JOSN API create_post does not allow creating post if you are not logged in. which means, no REST create_ost, only for logged in user and that too with admin rights.
You need JSON API User Plus for adding post. https://www.parorrey.com/solutions/json-api-user-plus/
On Wednesday, February 7, 2018, 11:24:36 AM GMT+5, raffaelecolleo <[email protected]> wrote:
Hi there,
I am trying to create a post using jSON Api and jSON Api User.
My username is administrator so should be ok and Password does not have & or # in it.
Here's what I am doing:
` var nonce = jQuery.getJSON( "https://www.example.com/api/get_nonce?json=get_nonce&controller=posts&method=create_post" );
console.log(nonce);
// ATTENTION: cookie was created on a login page and stored at localStorage.
var dataString = "controller=posts&method=create_post&cookie=" + localStorage.getItem("cookie") + "&nonce=" + _nonce_.responseJSON.nonce + "&post_type=my-custom-type&title=Post Created by APP";
console.log(dataString);
jQuery.ajax({
type: "GET",
url:"https://www.example.com/api/posts/create_post?",
data: dataString,
crossDomain: true,
cache: false,
success: function(data){
console.log(JSON.stringify(data));
},
error: function(data){
console.log(JSON.stringify(data));
}
});
I am getting back this error:{"readyState":4,"responseText":"{"status":"error","error":"Your 'nonce' value was incorrect. Use the 'get_nonce' API method."}","responseJSON":{"status":"error","error":"Your 'nonce' value was incorrect. Use the 'get_nonce' API method."},"status":403,"statusText":"Forbidden"}`
Any Ideas on how to solve this?
Thanks.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
With JSON API User Plus is a Subscriber allowed to create posts? |
yes, you can manage it from Option page of the plugin, allowing the non admin user to add_post, edit_post, delete_post
On Wednesday, February 7, 2018, 12:49:10 PM GMT+5, raffaelecolleo <[email protected]> wrote:
With JSON API User Plus is a Subscriber allowed to create posts?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
even though i'v loged in i still get the same results as the one mentioned above , The bad thing is if i try to write a post request from a browser it works fine but the same request doesnt work if requested from a postman with result from postman being the same as mentioned above and the result from a browser being status ok and post id and some other parameter . I think you need not to run away from this one bro , you need to fix this . |
Also something just came through my mind , To get as error that says "Your 'nonce' value was incorrect. Use the 'get_nonce' API method." is actually because the nonce is verified to not being valid as per source code available (Nonce is verified with wp_verify_nonce() function ) So how can you say its a log in issue even though the error is due to nonce verification failure that has appeared for a logged in user like me as explained above . I strongly think your argument of loged in user is of important but it is the case that will happen if the user did not provide authentication cookie from his request to create a post to a wordpress site . But if authentication cookie is given as one of the parameter as shown above by raffaelcolleo it crashes the loged in user issue and the main thing should be nonce verification "if statement) . Please try to go through your code to verify about that . |
JSON API User Plus has add_post, edit_post, delete_post endpoints.
JSON API create_post does not work in restful manner. It only allows you to create post if you are logged in via browser.
On Tuesday, April 10, 2018, 2:24:01 AM GMT+5, Emmjk <[email protected]> wrote:
even though i'v loged in i still get the same results as the one mentioned above , The bad thing is if i try to write a post request from a browser it works fine but the same request doesnt work if requested from a postman with result from postman being the same as mentioned above and the result from a browser being status ok and post id and some other parameter . I think you need not to run away from this one bro , you need to fix this .
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Oky , I went through your website to get the JSON Api plus plugin , It seems your plugin allows even non registered users to be able to write a post to my wordpress site . But what i want is a plugin that allows only registerd and loged in user to write a post on a wordpress based site but from an android application am making . Do you have any recommendations for that ? |
Ok. I bought 6 days ago the Single License. Sent emails to m [dot] ali [dot] qureshi [at] gmail [dot] com and no reply. I need to know where I can download the plugin. Any Ideas? |
I did not get any email from you. Please send an email at [email protected] or use contact form https://www.parorrey.com/contact/
On Thursday, April 26, 2018, 8:54:49 AM GMT+5, raffaelecolleo <[email protected]> wrote:
Ok. I bought 6 days ago the Single License. Sent emails to m [dot] ali [dot] qureshi [at] gmail [dot] com and no reply.
I need to know where I can download the plugin.
Any Ideas?
Thanks
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Hi there,
I am trying to create a post using jSON Api and jSON Api User.
My username is administrator so should be ok and Password does not have & or # in it.
Here's what I am doing:
I am getting back this error:
{"readyState":4,"responseText":"{\"status\":\"error\",\"error\":\"Your 'nonce' value was incorrect. Use the 'get_nonce' API method.\"}","responseJSON":{"status":"error","error":"Your 'nonce' value was incorrect. Use the 'get_nonce' API method."},"status":403,"statusText":"Forbidden"}
Any Ideas on how to solve this?
Thanks.
The text was updated successfully, but these errors were encountered: