Support » Plugin: JSON API » Authentication and Create Post

  • I am trying to use this JSON-API to create a post for my wordpress site from within a Ruby program.

    However, after a get a nonce and make the post call I get this response error:

    “error”=>”You need to login with a user that has ‘edit_posts’ capacity.”

    How is a user supposed to “login” via a Ruby program? I am using the HTTParty gem for making my REST calls.

    Here is the code I am using:

    nonce_response = HTTParty.get ""
    puts nonce_response.code
    nonce_info = JSON.parse(nonce_response.body)
    puts nonce_info["status"]
    puts nonce_info["nonce"]
    puts nonce_info.inspect
    post_body = {:nonce => nonce_info["nonce"], :status => "draft", :title => "this is only a test", :content => "great content here!",
                 :categories => "Test"}
    post_response = "", :body => post_body)

    Thanks for any tips,


Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Authentication and Create Post’ is closed to new replies.