MarkyC
Forum Replies Created
-
Forum: Plugins
In reply to: [JSON API] Send POST request to controllerThere was no language given, so I assume you mean a cURL command. First you must receive a nonce from get_nonce. Note that
%20is the character encoding of a space (‘ ‘)curl -X POST -d "nonce=my_nonce_from_get_nonce&title=my%20post&content=blah" http://example.com/blog/?json=create_post --header "Content-Type:application/json"See here for more parameters: https://ww.wp.xz.cn/plugins/json-api/other_notes/#2.2.-Pages-controller-methods
Can you please help out if this is the right tool to display wordpress blogs in the rails application?
I’m assuming you want to display the latest blog posts in your Rails application. The documentation explains how to do this.
I assume you know how to consume a REST API with Rails, as well as understand the JSON format, and how to interact with it. I do not know Rails, so I’m not going to be much help with this, but this is basic language stuff that you should learn prior.
You should be issuing a GET request on a URL like the following
http://www.example.com/blog/?json=get_recent_postsThe response will be something like
{ "status": "ok", "count": 10, "count_total": 79, "pages": 7, "posts": [ { "id": 14, "type": "post", "slug": "post-title", "url": "http://www.example.com/blog/?p=14", "status": "publish", "title": "Post Title", "title_plain": Post Title", "content": "...", "excerpt": "...", "date": "2014-07-29 17:23:45", "modified": "2014-07-29 17:23:45", "categories": [...], "tags": [], "author": { "id": 1, "slug": "markyc", "name": "MarkyC", "first_name": "", "last_name": "", "nickname": "MarkyC", "url": "", "description": "" }, "comments": [], "attachments": [], "comment_count": 0, "comment_status": "open", "custom_fields": {} }, ] }As a newbie, get used to reading more than coding. It will be very hard to learn or do something without reading about how it works.
Forum: Plugins
In reply to: [JSON API] Get new PostsPerhaps save a
last_updateddate, and useget_date_postsfrom afterlast_updatedThis is a vague question, maybe check the documentation. If all the features you require in a blog appear in the documentation, I’d assume you are good to go