Giter VIP home page Giter VIP logo

wp-json-api's People

Contributors

dphiffer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wp-json-api's Issues

attachment images bugs

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.

Issue getting images on multisite

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?

OpenSearch REST API request

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.

Open Graph

Hi,

There is a possibility to add open graph in your plugin. I will be appreciated if you can help me with that. Thanks

Front page implicit JSON not working

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.

I just want plain text from JSON API result

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:
jsonapi
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

fatal error: allowed memory size exhausted

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

order_by meta_value invalid

img

http://localhost/wordpress/api/get_category_posts/?id=63&meta_key=post_views_count&order_by=meta_value&order=desc

This query is invalid

Feature Request: get_categories method

Method: get_categories
Returns an array of categories.

One of the following is required

  • Invoking the JSON API implicitly (i.e., ?json=1) on a category URL
  • id or category_id - set to the category's ID
  • slug or category_slug - set to the category's URL slug

Optional arguments

  • children - set to a non-empty value to include a recursive hierarchy of child categories

post__not_in is not working

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?

How to upload image from local disk

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

Unknown method returns 200

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?

HTTP 500 Error on get_page_index and 25 Failed Tests

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

Still active?

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!

Your 'nonce' value was incorrect. Use the 'get_nonce' API method.

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 .

using guzzle with symfony2 app first post success but after the post request doesn't work

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

Modifing response format

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&#039;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&#039;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
    ],               
  }
}
  • As a side note we consume this API in react/redux apps.
  • The above response is "normalised" and is thus smaller on network traffic.
  • We already have a transformer written for the PHP Fractal API transformer library

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.