dphiffer / wp-json-api Goto Github PK
View Code? Open in Web Editor NEWWordPress JSON API
Home Page: http://wordpress.org/extend/plugins/json-api/
WordPress JSON API
Home Page: http://wordpress.org/extend/plugins/json-api/
Hej!
I can't get post__not_in
parameter work when I fetch a bunch of posts. When use the following to fetch posts www.example.com/api/get_posts/?post_type=custom_post_type&post__not_in=array(1,2,3,4,6)&count=6&offset=0
, everything works fine but the posts with the ids 1,2,3,4,5
are not excluded in the response.
What am I doing wrong here?
Hello,
I have a problem when making an ionic app similar Blog reader from unity3dindonesia.com using your JSON API Plugin. It will give an unexpected result like my screenshot below when testing on Ionic Serve:
Its mean JSON result for one ID post not just give plain text but mixed with some plugins already installed on my blog such as Crayon Syntax Highlighter and Jetpack.
So How I can exclude JSON result from two plugins like above?
Please check out JSON result one post from my blog: http://unity3dindonesia.com/api/get_post/?callback=JSON_CALLBACK&id=25
Best Regards
Hi,
There is a possibility to add open graph in your plugin. I will be appreciated if you can help me with that. Thanks
Could you update this to the 1.1.1 version?
hello,
first thanks, for this amazing plugin. had thought to have to write this all for by myself.
the plugin works fine on my lampp and also at an hosted online installation (murstrom.at) but is not working at the installation, where i need it
honestly, i dont know if the problem is at the plugin or at my server side, but i suppose, that the problem causes of the use within a subdomain.
the installation: http://openscience.alpine-geckos.at
wordpress 3.5
json api Version 1.0.7
the error:
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 82 bytes) in /wordpress/openscience/wp-includes/capabilities.php on line 750
it is happening when i create a new post or i want to add a widget, maybe otherwise too, but havent tested all options right now.
regards, stefan
Hello,
I am trying to run the plugin on cafemarathi.com. When i go to https://cafemarathi.com/api/get_page_index/ I am getting a blank page and HTTP 500 error.
I ran the rests using pear HTTP-Client and I am getting 25 Tests Failed:
Here is the output:
wrote log to "/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/run-tests.log"
TOTAL TIME: 00:01
0 PASSED TESTS
0 SKIPPED TESTS
25 FAILED TESTS:
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.get_author_index-01.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.get_author_posts-01.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.get_author_posts-02.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.get_author_posts-03.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.get_category_index-01.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.get_category_posts-01.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.get_date_index-01.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.get_date_posts-01.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.get_date_posts-02.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.get_date_posts-03.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.get_page-01.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.get_page-02.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.get_post-01.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.get_posts-01.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.get_posts-02.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.get_posts-03.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.get_recent_posts-01.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.get_recent_posts-02.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.get_recent_posts-03.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.get_search_posts-01.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.get_tag_index-01.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.get_tag_posts-01.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.info-01.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/core.info-02.phpt
/var/www/cafemarathi/htdocs/wp-content/plugins/json-api/tests/query-01.phpt
I am on Apache on Ubuntu 14.04 Amazon EC2
Inside of the /models/attachment.php file, there is a lack of WordPress API usage - for instance using getimagesize & file_exists should probably not be used for performance, as WordPress stores that info in the attachment meta database.
Basically - the issue I'm having is very hard to debug based on the number of conditionals inside of JSON_API_Attachment::query_images()
Is the API not returning any images because the size php reports is different from what WordPress has stored? Is it because the webserver can't find the file path? Is the file path it's checking correct?
I'm left with a broken homepage because the API isn't returning any images, just an empty array.
I tried to use the plugin from postman to query data from wordpress site , but this is the best i could go . I'v been receiving this same error for weeks now .
What i have already tried
-> I'v tried to add cookie as a header with cookie_name=cookie_value as the value of the field , but still got the same result .
->Trying to run the same post request without cookie in the header here is the error i get "You need to login with a user that has 'edit_posts' capacity" which i thought using cookie to identify the user will make lots of sense just like in creating a comment .
Hi,
I am trying to get a specific user custom posts using https://www.domain.com/api/get_author_posts?id=12345&post_type=my-custom-type" but returns 0 posts.
But if I log in and past the link onto chrome it works.
Do I have to do something before asking for the posts?
I am trying to get the custom posts outside de domain using jquery and using JSON API User Plus.
Any Ideas?
When setting a static front page, the JSON api does not return the static page content, it returns the blog page array of posts, which is incorrect.
I really like the plugin, but I don't have the familiarity to the code to fix it myself.
After some debugging, it appears that is_front_page() is false when json_api_encode filter fires, even though it should be true.
this plugin looks like exciting stuff! but wondering if this project still maintained/under active development? would be good to know before installing/integrating. thankya kindly in advance!
Hi,
I read your tutorial completely, but was unable to make out, when creating a post, how can i upload and attach an image to the post. Can you please give a sample code for this?
Regards,
Vinay
I'm currently trying to write some OpenSearch plugins with suggestions, again. In this case it shall be for "keyforsteam". And i recognize, that this is some kind of API task. This is, how i found your project. After a short look at your code, trying the corresponding REST API aspect and some sniffing on the network traffic, i found something appropriate for me.
https://www.keyforsteam.de/wp-admin/admin-ajax.php?action=catalogue_query&template=live-search&query[search]=Battlefield&query[productsPerPage]=16&query[currency]=eur&query[locale]=
This query will list all found games for the corresponding query. The "live search" uses it. But the result isn't in JSON! After some digging i found, that 'wp-json' would give my what i expect. But it requires permission. So i guess what is missing is some kind of 'query[format]=json'.
Although i have decades worth of experience, i'm not into programming and especially not into JavaScript. But i found, that the solution for my problem may benefit your code as well. So maybe you know an answer or you can achieve to find it. Let me know.
Best regards.
Hi !
I installed this plugin on my project Wordpress
I tested my webservice with client http everything work.
But when I'm using guzzle the first post work correctly but in the second test
Get request work correctly but when I send Post request it always return my home page not Json response as I expect.
I tested also in Ubuntu the same result.
I don't know how to correct this Issue !
Please help me
I found a tiny bug (a notice actually) on row 174 of json-api/singletons/api.php.
Fix: isset($info['url'])
Method: get_categories
Returns an array of categories.
One of the following is required
Optional arguments
I have a multisite where I am creating posts and uploading images in the one site and just tagging the post to be added to the other. In the main site the json response includes thumbnail_images as an array, however in the other site I am getting all post info except the thumbnail_images array which is coming up null.
In my settings I am querying 2 different urls; www.site1.com/api and site2.com/api. www. site1.com/api is working perfectly but site2.com is not bringing in images.
Is this a known issue with a work around?
When i have post a comment using json api how to get user avatar in responce.
Where to change may code.
Post data using Url:
http://www.xxxyyy.com/?json=respond.submit_comment&post_id=95806&name=sard&email=sard123%40gmail.com&content=this is comment testing
Responce:
{
"status": "pending",
"id": 749025,
"name": "sard",
"url": "",
"date": "2015-03-28 11:21:39",
"content": "
this is comment testing
\n",GET /api/foo/
=> {"status":"error","error":"Uknown method 'foo'."}
... which is all well and good (I've put in a PR for the typo). But the response code in this case is 200, which implies some sort of success; a 4xx error (probably 404) would surely be more appropriate?
Is it possible to get registered menus, or should I use an extension plugin! I have angular app and I'm trying to make my main menu dynamic
Hi ,
I am try to make mobile app using JSON -API and AngularJS and i install JSON -api Plugin in my wordpress site and also get data using get method using
I want Login And Register in my app.
Can you guide me some tutorial ,blog or Example to do this?
Is there anyway to modify the response format from the standard?
The current standard is:
{
"status": "ok",
"count": 1,
"count_total": 1,
"pages": 1,
"posts": [
{
"id": 1,
"type": "post",
"slug": "hello-world",
"url": "http:\/\/localhost\/wordpress\/?p=1",
"title": "Hello world!",
"title_plain": "Hello world!",
"content": "<p>Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!<\/p>\n",
"excerpt": "Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!\n",
"date": "2009-11-11 12:50:19",
"modified": "2009-11-11 12:50:19",
"categories": [],
"tags": [],
"author": {
"id": 1,
"slug": "admin",
"name": "admin",
"first_name": "",
"last_name": "",
"nickname": "",
"url": "",
"description": ""
},
"comments": [
{
"id": 1,
"name": "Mr WordPress",
"url": "http:\/\/wordpress.org\/",
"date": "2009-11-11 12:50:19",
"content": "<p>Hi, this is a comment.<br \/>To delete a comment, just log in and view the post's comments. There you will have the option to edit or delete them.<\/p>\n",
"parent": 0
}
],
"comment_count": 1,
"comment_status": "open"
}
]
}
We would like to use wp-json-api
as a "headless CMS" integrated into our current API. Thus we would want to transform our responses as per the rest of our API:
{
"data": {
"posts": [
{
"id": 1,
"title": "Hello world!",
"title_plain": "Hello world!",
"content": "<p>Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!<\/p>\n",
"categories": [92,61,21,6,32,7],
"tags": [22,3,1,12],
"comments": [1], // see here
"author": 1, // see here
},
{
"id": 2,
"title": "Another Post!",
"title_plain": "Another Post!",
"content": "<p>Another Post...<\/p>\n",
"categories": [6,32,7],
"tags": [17,1,44],
"comments": [], // see here
"author": 1, // see here
},
],
"comments": [
{
"id": 1,
"name": "Mr WordPress",
"url": "http:\/\/wordpress.org\/",
"date": "2009-11-11 12:50:19",
"content": "<p>Hi, this is a comment.<br \/>To delete a comment, just log in and view the post's comments. There you will have the option to edit or delete them.<\/p>\n",
"parent": 0
},
],
"authors": [
{
"id": 1,
"slug": "admin",
"name": "admin",
"first_name": "",
"last_name": "",
"nickname": "",
"url": "",
"description": ""
}
],
"tags": [
// ... you get the idea
],
"categories": [
// ... you get the idea
],
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.