Make WordPress Core

Tagged: gsoc Toggle Comment Threads | Keyboard Shortcuts

  • Jen 7:01 pm on February 7, 2014 Permalink
    Tags: gsoc,   

    GSoC: Now’s the Time 

    Hey all. I created our org profile for GSoC and have started filling out the application. Before I submit it, our ideas page needs to be bursting with project ideas and potential mentors. To that end, if you are interested in mentoring (co-mentoring a specific student, or just being a casual helper-outer in our gsoc channel when the time comes), let’s get you listed and get those project ideas posted.

    Go to https://codex.wordpress.org/GSoC2014 and log in to the codex (your wordpress.org u/p). You will see that I’ve made a template for posting project ideas. Just click the Edit link next to Ideas or next to the template labeled “Project Idea (copy this section, paste below…”, and add your idea to the list below the ones that are there. I filled in one for the standard Full-throttle Trac Annihilation idea using the template so there would be at least one example there for the first poster.

    Post as many good ideas for projects as you can think of. Make sure they are substantial enough to constitute a full-time summer job for the student, but not so grand that they won’t be able to finish in 3 months. Note that we always require their working prototype by midterm, so really they should be able to do the primary coding in 6 weeks, with the 2nd 6 weeks for revision, documentation, testing, merging, etc.

    Mentors who volunteered on the last thread have been posted in the Mentors section, but you should go in and edit your description to give some info about you, your areas of interest, etc. All mentor names should link to their wordpress.org profiles, as you see with the ones I’ve already posted. If you’d like to link to your own personal site for more info, please do so in the description rather than linking your name there.

    It says please don’t edit the mentors section without talking to me first. If you have been a previous mentor for GSoC (or have been listed as mentor before but didn’t wind up with a mentee), consider yourself as having talked to me and go ahead and add yourself to the list/edit your description. If you have never gone through the GSoC process before, please ping me in irc so I can review stuff with you (expectations, etc) before officially putting you on the list.

    If folks could start adding to this page now and continue over the weekend, then by Monday we can do a review to see if there are big gaps where I need to go mentor-hunting before submitting the application.


  • Jen 6:20 pm on January 29, 2014 Permalink
    Tags: gsoc,   

    GSoC 2014 

    It’s that time of year again, when all good* core developers start thinking about whether or not they’re up for mentoring a GSoC student this year. Many in this group know the drill, but there quite a few involved core contribs active this cycle who haven’t been involved with GSoC before, so here’s the deal:

    • Google pays for a program that gives college students summer jobs creating open source code under the mentorship of an organization (like WordPress).
    • We apply to be a mentoring organization and put up a list with a bunch of potential summer project ideas and identify who the mentors might be.
    • If we’re chosen to participate, we get a certain number of slots to fill, and students submit applications to work with us.
    • All the potential mentors rate/rank the proposals, and decide if there’s someone they’d like to mentor.
    • In game of chance-meets-requests dizzy enough to rival medical school matches, we put together our wish list for mentor-student matchups. 2 mentors per student, to provide coverage and make things more collaborative.
    • We hope that none of our top picks also applied to other orgs who accepted them, and wind up with our student roster.
    • We provide volunteer mentors to work one-on-one with the kids on projects that they applied to do over a 3-month period.
    • Open source code is released into the wild.

    I’ll be putting together our application to be a mentoring organization this week, so it’s time to start thinking of project ideas we could suggest on the Ideas page that we need for the application (the more ideas the better) and who wants to be a mentor. The application deadline is February 14, so I’d like to get the Ideas list in solid shape (along with mentor bios) by Feb 10 (a week from Monday).

    If you have an idea or are interested in being a mentor, please leave a comment on this post. At the end of the dev chat after 3.9 business is out of the way, we can discuss some of the ideas and I can answer any questions people have about mentoring.

    Related: I’m also going to be posting soon about starting up a regular mentorship program, as outlined here. But that can wait for another day.

    *Where good means both skilled and kind and generous with their time.

    • Jen Mylo 6:22 pm on January 29, 2014 Permalink | Log in to Reply

      Also, will need a few people to identify tickets that no one’s working on that would be good ones to use for the “submit a patch” requirement of the application.

    • Ian Dunn 6:59 pm on January 29, 2014 Permalink | Log in to Reply

      Is it only open for Core, or can Meta, Mobile, etc also propose projects?

      • Andrew Nacin 7:10 pm on January 29, 2014 Permalink | Log in to Reply


        • Ian Dunn 7:54 pm on January 29, 2014 Permalink | Log in to Reply

          Awesome. @jenmylo, I’d be happy to mentor someone if you have any Community projects you think would be a good fit for GSoC.

          • Jen Mylo 8:41 pm on January 29, 2014 Permalink | Log in to Reply

            @iandunn: Definitely, just need to make sure that it’s something releasable, like a plugin vs building onto one of the sites. Maybe forms, finally?

            • Ian Dunn 9:04 pm on January 29, 2014 Permalink

              That could work. The idea of having the pre-defined forms for speakers/sessions/etc is specific to WordCamp.org, but we could easily put the general architecture for a pre-defined form into the plugin itself, and then define WordCamp.org’s specific forms via a filter in a custom plugin.

              The result from that approach would be the same as if the our forms were built into the plugin itself, but it would keep the core plugin independent so it could be released in the WordPress.org repo and used by anyone.

              We don’t necessarily have to release it in the wporg repo in order to open-source it, though. Most of WordCamp.org’s custom stuff is already open-sourced in the Meta repo. Not sure if the GSoC guidelines just want it open-source, or if the spirit of it is to make it easily available/useable for others.

    • Wojtek Szkutnik 7:48 pm on January 29, 2014 Permalink | Log in to Reply

      Always happy to help with mentoring if needed :)

    • Marko Heijnen 8:48 pm on January 29, 2014 Permalink | Log in to Reply

      I would love to mentor. Hopefully this time I’m more lucky then last year. I can help with core, mobile or GlotPress.

      • Jen Mylo 9:20 pm on January 29, 2014 Permalink | Log in to Reply

        If you can write up some specific project ideas that you would like to mentor, that will help with the luck. Someone who applies for your idea would likely be given to the person who proposed it, vs running into a situation like last year where a handful of people all requested the same student.

    • Justin Shreve 9:28 pm on January 29, 2014 Permalink | Log in to Reply

      I’m interested in mentoring this year (did you even have to ask? :))

      Some things I would be interested in (based on some previous ideas):

      • New User Walkthrough. Specifically meter based “you are 10% setup, etc”. Think LinkedIn style.
      • A visual way to surface visual embeds / oEmebeds etc. Instead of needing to magically know that a Spotify or Twitter URL needs to go on its line, support some kind of UI (maybe in the media explorer) that allows you to insert content
      • Anything External API Related. No specific project here. It depends on what is in core at the time (if it’s XML-RPC still or if REST is available yet)
      • General Mentoring
    • Eric 9:35 pm on January 29, 2014 Permalink | Log in to Reply

      I’m game to mentor a mobile project this year. I’ll post some project ideas after I’ve had some time to brainstorm a bit.

    • Aaron Jorbin 5:04 pm on January 31, 2014 Permalink | Log in to Reply

      I would love to mentor once again. Some ideas that I have:

      • Make the PHPUnit tests run faster
      • Increase the number of JavaScript Unit Tests
      • CSS/JS Optimization
      • Automated performance testing
      • Anything dev tools related.
      • Bryan Petty 5:31 pm on February 4, 2014 Permalink | Log in to Reply

        I think the biggest improvement we could make to the unit tests in regards to speed is to find a way to merge multisite tests into the base tests, and only run tests that are actually affected by single/multisite environment changes.

        Right now, we run every single unit test a second time during the multisite run, but in reality, probably less than 25% of them are even affected by multisite. For example, we don’t need to re-run sanitize/escape tests a second time.

        There’s certainly probably lots of places we could avoid @runTestsInSeparateProcesses, especially if we were to deprecate/remove constants.

        Another option might be to find a way to cleanly reset the DB without calling wp_install() again (do one install, dump, and reload from dump directly on the next test with @runTestsInSeparateProcesses).

        Other than that, then you just have optimizations on individual tests, which just becomes a mundane task that no-one wants to do, especially if patches are just ignored because they are so minor and not important.

        • Andrew Nacin 7:43 pm on February 4, 2014 Permalink | Log in to Reply

          Re-running the entire suite under multisite has flagged a lot of issues over the years. I think we’re along way from that point. Multisite just has too many odd side effects on core.

  • Ryan McCue 2:36 am on September 28, 2013 Permalink
    Tags: gsoc, , ,   

    JSON REST API: Version 0.6 and The Future 

    We’ve finally come to the end of Summer of Code, so it’s time for the final GSoC release in this slightly late update (hey, would it be a post by me if not?). This release is mainly a stability release, so there are only minor changes:

    • Huge documentation update – Guides on getting started and extending the API are now available for your perusal
    • Add generic CPT class – Plugins are now encouraged to extend
      WP_JSON_CustomPostType and get free hooking for common actions. This
      removes most of the boilerplate that you needed to write for new CPT-based
      routes and endpoints (#380)
    • Use defined filter priorities for endpoint registration – It’s now easier to
      inject your own endpoints at a defined point
    • Update the schema – Now includes documentation on the Media entity, plus more
    • Add better taxonomy support – You can now query for taxonomies and terms directly. The routes here might seem strange (/posts/types/post/taxonomies/category for example), but the intention is to future-proof them as much as possible (#275)
    • Ensure the JSON URL is relative to the home URL (#375)
    • Check all date formats for If-Unmodified-Since (#378)
    • Register the correct URL for the JS library (#376)
    • Correct the usage of meta links (#379)
    • Add filters for post type and post status data (#380)
    • Separate parent post and parent comment relation (#330)

    The big feature for this final week is a bunch of documentation changes. I’ve created guides and documents on how to use the API, intended for both beginners and experts. I’d especially like to highlight the Getting Started guide, as well as the Extending the API guide for plugin developers. The documentation in the past has been less than fantastic, so I’ve made a concerted effort towards it this week. In addition, I’ve also fixed up all the remaining bugs reported via Trac.

    Now that GSoC’s over, what’s next? The aim with the project is to now move it from a solo project to a team one, and to that end, I’ve been working on assembling a fantastic team to work on the project with, with aim to integrate the API into core in the future. 3.8 time is fast approaching, so we’ve elected to aim for 3.9 as a more realistic target, although the advantage of the Feature as a Plugin method of development is that we’re not locked down here.

    We’re held two meetings so far as a team, and I’ll announce a proper office hours time next week, but I’m also looking to try something new with the organisation of the team. More to come on that in the next team update, but in the meantime, you can check out the internal team discussion site. Anyone looking to get involved in the team is welcome to join as always, but I’d ask that only those serious about working on the project join, as there are a fair few people committed already.

    Thanks to everyone, especially my mentors and Jen, for making this project a joy to work on so far. Here’s hoping we can keep the momentum as we push forward with the project.

  • Ryan McCue 8:27 am on September 12, 2013 Permalink
    Tags: gsoc, , ,   

    JSON REST API: Version 0.5 

    This week, I finally have a new release for you! Version 0.5 is now available, with the following changes (and more!):

    • Add support for media – This has been a long time coming, and it’s finally at a point where I’m happy to push it out. Good luck. (#272)
    • Separate the post-related endpoints – Post-related endpoints are now located in the WP_JSON_Posts class. When implementing custom post type support, it’s recommended to subclass this.

      The various types are now also only registered via hooks, rather than directly in the server class, which should make it easier to override them as well (#348)

    • Add page support – This is a good base if you’re looking to create your own custom post type support (#271)
    • Switch from fields to context – Rather than passing in a list of fields that you want, you can now pass in a context (usually view or edit) (#328).
    • Always send headers via the server handler – Endpoints are now completely separate from the request, so the server class can now be used for non-HTTP/JSON handlers if needed (#293)
    • Use better error codes for disabled features (#338)
    • Send X-WP-Total and X-WP-TotalPages headers for information on post/pagination counts (#266)

    As always, the full changes are available if you’re interested.

    This week finally brings media into the fold. The process for uploading media is a little different to creating normal posts, so here’s how you do it.

    First, upload the file via a POST request to /media. This can either be as a standard HTTP multipart body, with the name field set to file, or as a raw file in the body with the Content-Type header. (You can also optionally send a Content-MD5 header if you’d like the server to check the consistency of your file.) This will give you a 201 Created status, and point you to the new resource. You can now update that resource with the correct post data.

    This multistep procedure is required to enable raw file uploads, and I’m not entirely pleased with it, but it’s the only way without requiring multipart requests. I’d love to have feedback on this system, as I think practical use will eventually reveal the correct method here.

    So, it’s time to start winding up the Summer of Code portion of the project. There’s still one week left for the Summer of Code project, so you may still see a release next week, but most likely in the form of smaller updates, especially with documentation and testing. As I finish up, it’s time to look forward to the future of the project. The plan is to form a Feature as a Plugin team as we work towards core integration in future releases. People have already volunteered for the team back in the 3.8 scoping days, and I’ll be getting in contact with them shortly, but it’s not too late to nominate yourself for the team; let me know if you’re interested.

    Thanks to everyone for testing and for your feedback. Stay beautiful.

  • Ryan McCue 2:20 pm on September 4, 2013 Permalink
    Tags: gsoc, , ,   

    JSON REST API: Coming Soon 

    It’s been a while since you’ve all heard from me, so I wanted to check in and assure you I am still alive. I’ve been plodding along behind the scenes with the JSON API and mostly getting design documents sorted.

    The big feature I’m working on at the moment – media – has turned out to be tricker than I initially thought. While media is technically handled via custom post types, it’s a completely different kettle of fish to normal post types, so I’ve been working through the conceptual issues behind this to ensure that the API stays consistent both internally and externally. I really believe that it’s worth my time to sit down and consider these conceptual issues in depth rather than pumping out the feature as soon as possible. (The implementation of the media-related endpoints is working locally, but I don’t want to push this up while it’s still in flux.)

    I still hold out hope to push through media, but will likely reduce the scope of the other tasks to compensate, due to the complexity of media and the time it has taken so far. I’d like to personally apologise for this, this is a result of improper scheduling for the second half of the project.

    Personally, the past month or so has been pretty stressful as well, due to a number of other things going on in the background. Balancing this project with university work has become a big issue recently, so I’m working through this as best as I can. Ideally, my preferred option at this point would be to push this project out of the Summer of Code phase and into the open source team phase rather than continuing to work on the project in isolation.

    Along those lines, revisions will be bumped from the Summer of Code phase completely. While they are part of core functionality, they’re a rather large task that is secondary in importance to media and also behind taxonomy handling. I’d love to see these in the plugin at some point, but that won’t be happening during the Summer of Code phase. What I would love is for someone to volunteer to develop this (in a separate plugin for now, thanks to GSoC’s restrictions) for integration back in as soon as possible, which would also help with validating the API’s usefulness.

    So again, sorry and hopefully I’ll have something better to show you next week. Thanks for your patience.

  • Ryan McCue 1:00 am on August 8, 2013 Permalink
    Tags: gsoc, , ,   

    JSON REST API: Version 0.4 

    After a week’s hiatus thanks to WCSF and the midsemester review, I’m back with a new release of WP API! Version 0.4 is now available with the following changes:

    • Add Backbone-based models and collections – These are available to your code by declaring a dependency on wp-api (#270)
    • Check json_route before using it (#336)
    • Conditionally load classes (#337)
    • Add additional test helper plugin – Provides code coverage as needed to the API client tests. Currently unused. (#269)
    • Move json_url() and get_json_url() to plugin.php – This allows using both outside of the API itself (#343)
    • getPost(0) now returns an error rather than the latest post (#344)

    As always, the full changes are available if you’re interested.

    This release brings the first version of the Javascript API, based on Backbone models and collections. To use it, simply declare `wp-api` as a dependency to your script, then start using the `wp.api` classes. Here’s a quick example of how to use it:

    var posts = new wp.api.collections.Posts();
    	success: function (posts) {
    		var post = posts.at(0);
    		var title = post.get('title');
    		post.set('title', title + ' (Updated!)');

    These are intended purely as building blocks for your own software. I had been looking at rewriting P2 partially to use these, however it appears that would require gutting P2 and basically starting from scratch, due to P2’s architecture. I’d love to see what you can do with this though, and bonus points if you can get a API-ified P2!

    The coming week will introduce some specialised page handling as an example of how to enable custom post type support, plus the beginning of the media/attachment-related APIs. These will probably be a fair bit of work, so it’s possible only basic functionality will land next week.

    • John Blackbourn (johnbillion) 1:27 am on August 8, 2013 Permalink | Log in to Reply

      I didn’t realise you were planning a JavaScript interface to the API too. That’s extremely cool.

      • Ryan McCue 1:28 am on August 8, 2013 Permalink | Log in to Reply

        It serves as an example of how to use the API, plus another way to test it, so it kills two birds with one stone. :)

    • Manny Fleurmond 1:58 am on August 8, 2013 Permalink | Log in to Reply

      This is so going to help me with my gallery plugin when you add Media support

    • Beau Lebens 3:10 pm on August 19, 2013 Permalink | Log in to Reply

      This is really cool stuff Ryan, especially the Backbone wrappers. I’m going to check it out in detail as we’re working on http://geto2.com, which is the next generation of P2, and is already based on Backbone (although most of that was written well before this was available, so we’ve implemented it all ourselves).

  • Ryan McCue 2:52 pm on July 24, 2013 Permalink
    Tags: gsoc, , ,   

    JSON REST API: Testing Updates 

    This week is a little different to the previous ones, as it’s a primarily testing focussed week. I’m skipping the release for this week in favour of just an update post.

    I noticed fairly late this week that the aforementioned client library wasn’t actually public and available to you guys, so I’ve now fixed that up. Given the lack of comments, I’d hazard a guess this also means no one tried using it. :)

    Previous Week

    Over the past week, I’ve been looking at a variety of testing-related items, including code coverage and schema validation. I’ve finally sorted the schema validation out with the help of a JSON Schema validation library, after much messing around. The unit tests now integrate this schema validation with the normal testing suite, which should ensure that the API is conformant to the specification as well as fully functional. I do suspect that the schema is slightly outdated and is missing a few items, so I’ll be ensuring the documentation and schema are consistent in the next week.

    Another area of the testing that I’ve been looking at is working with code coverage. After exploring the inner workings of PHPUnit’s code coverage, I think I’ve worked out a solution using a test helper plugin. This gathers the statistics on the server, then serialises them to send them back to the client. This still needs the PHPUnit end to connect to, which should be simple once I work out how to override the PHP_CodeCoverage object. (Help here would be appreciated if anyone has familiarity with PHPUnit.)

    I’ve also started work on the Backbone client, however that’s currently not in a state to release. The plan here is to create a generic set of Backbone-based classes that can be used as a library, with the proof-of-concept itself being a theme based on P2. I’ve started work on the Backbone side of things, however I’ve not worked on much here with the theme side. I suspect that P2’s Javascript will be discarded in large part, but hopefully I can avoid that as much as possible.

    Next week, you can look forward to more testing updates and the Backbone client. I’ll also be pushing out a new version with some bug fixes (thanks to Mike Schinkel for reporting these) as well as the usual slate of updates.


    I’ve also discovered that my documentation thus far has been a little lacking, so here’s a bit of an intro to using the API.

    After downloading and activating the plugin, your site will now capable of serving up data from its API. The API is accessible at /wp-json.php from your site (if you’re not sure where this is, copy your admin URL and replace wp-admin with wp-json.php), with the specific route added after this. For example, the index is available at /wp-json.php/ and a list of your posts is available at /wp-json.php/posts.

    If you’d just like to take a look around, you can view this in your browser and navigate via the links in the JSON. I personally use JSON View for this in Firefox, which converts the URLs in the data into proper hyperlinks as well as making it easier to view the data. The API uses a concept called HATEOAS, which basically means that all the possible data is discoverable via these links.

    Some endpoints will add extra data if you’re logged in with the correct permissions. You can log in via the normal WP login page if you’re just viewing this in your browser (using cookie-based authentication), but if you’re accessing the API programatically, the API also has built-in support for HTTP Basic authentication. (OAuth support is not planned for the core of the plugin, but my OAuth provider plugin might be a good start for anyone who wants to write this as a plugin.)

    I’m always open to questions regarding how to use this, so let me know here or on Twitter if there’s anything I can do to help you out.

    • Aaron Brazell 3:00 pm on July 24, 2013 Permalink | Log in to Reply

      Love it. I did submit a ticket you should consider for your next release. Making the whole thing Multisite aware. Good work and good luck!

      • Ryan McCue 4:56 am on July 25, 2013 Permalink | Log in to Reply

        I replied on the ticket (note that notification settings aren’t copied across from core Trac); multisite is out-of-scope for the GSoC project, but there’s a multisite plugin you can activate that should maybe hopefully work. Integrating this is out-of-scope, since I don’t actually have a multisite install handy (so testing would be appreciated).

    • Mike Schinkel 5:26 pm on July 24, 2013 Permalink | Log in to Reply

      Thanks for the ack.

      A note about HATEOAS. One of the primary benefits of HATEOAS is that it allows the server to change its URL space as needed however if an API publishes its URL structures to allow developers to construct URLs then the primary benefit of HATEOAS and the justification people use for the significantly increased complexity on the client is pretty much moot. Those developers coupling their apps to the APIs make it not viable to change the URL space in the future as too many existing apps would break.

      That said, IMO the URL space for “well-known” APIs should be accessible by URL construction though me stating this drives the REST purists mad.

      Additionally, if the API serves a generic content type such as "application/json" vs. a content like something like "application/wordpress+json" a client should not know how to handle the response representation as doing so violates RESTful constraints. If the latter content type were used then it would be RESTful to write a client that knows the structure which as a side note diminishes the need for a schema.

      OTOH having a WordPress-specific content type could have real benefits because it would allow for the development and evolution of RESTful WordPress-specific clients that don’t violate “the rules”; it would allow WP clients to avoid the need to layer application logic on top of a generic content type. And it could potentially result is a slew of new clients that can integrate with the WordPress API. But then again maybe that’s something that can be considered before WordPress 4.0+.

      Speaking of schemas this post discusses REST and description documents. It discusses WADL not JSON Schema but many of the concerns still apply.

      Back to HATEOAS, if the URL structure is published for URL composition and a generic media type is used them the only real benefit you get from HATEOAS is inline documentation, which is a real benefit. But to say an API supports HATEOAS and also URL construction is analogous to owning a Ferrari without an engine; you get to admire it’s looks but you can’t use it for what it’s meant for, to be driven.

      Finally, HATEOAS is not required, it is for stable architecture meant to last decades; URL construction if perfectly workable and probably 95+% of APIs on the open web use it, although it does annoy the REST purists. But URL construction makes decades long implementations much less likely. FWIW.

      • Ryan McCue 5:08 am on July 25, 2013 Permalink | Log in to Reply

        So, given that we’re aiming to have set routing, you might ask why HATEOAS is needed at all. The primary motivation for this is to ensure that we have at least some sort of workable solution for pluggability. It’s conceivable that a plugin could change all of the routes, or rework some of them, so adding this means that clients can be robust in terms of routing if they’d like.

        A content type (likely application/vnd.wordpress.api.v1+json) is something that I’d like to use eventually, but I haven’t yet for various reasons. The main one of these is that even vnd. types should be registered, but the format is still in flux, so it’d be inappropriate to register it now.

        As for the schema, the intention of that is to be specific about how exactly to parse the responses, without me having to write ABNF for every single field. I’ve written ABNF for the more structured ones, but the point is to be as explicit about the data as possible. The fact that I can use that for automated testing is a huge plus, but it’s primarily a documentation tool (which is also why it lives in the docs directory).

        • Ryan McCue 5:27 am on July 25, 2013 Permalink | Log in to Reply

          (Just to clarify on the registration of vnd. types: you technically don’t have to register these, but it should be at least discussed with IANA. In addition, this would require the consent of the core team, and they’re rather busy, so it’s not worth the pain.)

    • Dan 5:22 am on July 25, 2013 Permalink | Log in to Reply

      Very cool stuff! Do you have any plans to add an endpoint for uploading media?

    • arpowers 7:31 pm on July 28, 2013 Permalink | Log in to Reply

      Can’t figure out how to make this thing work… couple questions:
      what’s a good example url once installed?
      Does this thing work on localhost?
      Are there any special permalinks settings id need?

      We can help you with this thing, just give me some basic help 😉

    • Julien 6:23 am on July 30, 2013 Permalink | Log in to Reply

      Same here, I got issues and nothing happened. On google Chrome, it tells there is a server error 500 when trying the URL /wp-json.php/posts/ and on Firefox it tells anything, just the white screen of death lol.

      Has the user need to set permalinks “on” in order to use the API or not ? Will wp-json.php will be hidden later with permalinks ? Like reaching the API with this kind of url : /api/v1/posts/ or /api/posts/

      Also, is there a way to place the posts IDs in the URL for retrieving a specific post on a GET request => /api/v1/posts/25 ?

      I really like this project, keep up the good work !

      • Ryan McCue 7:23 am on July 30, 2013 Permalink | Log in to Reply

        Yes, permalinks do need to be on. Once integrated into core, this shouldn’t be needed.

        The `wp-json.php` is intentionally in the URL and replaces a `/api/` component in there. Versioning will not be in the URL, but rather in HTTP headers/content-type.

        For a specific post, the URL is `/wp-json.php/posts/` (this is also linked from the `/posts` endpoint).

    • Mat_ 7:33 pm on August 2, 2013 Permalink | Log in to Reply

      Great news, will try this deep next week (as part of an open-data project for a semi-public french structure).

  • Ryan McCue 1:20 pm on July 17, 2013 Permalink
    Tags: gsoc, , ,   

    JSON REST API: Version 0.3 

    Time for another release of the JSON REST API! We’re closing in on midsemester evaluation, so it’s time to get our test on and ensure that everything’s working well. Only small updates to the API itself this week, but also the first introduction of the comment API:

    • Add initial comment endpoints to get comments for a post, and get a single comment (#320)
    • Return a Post entity when updating a post, rather than wrapping it with useless text (#329)
    • Allow filtering the output as well as input. You can now use the json_dispatch_args filter for input as well as the json_serve_request filter for output to serve up alternative formats (e.g. MsgPack, XML (if you’re insane))
    • Include a profile link in the index, to indicate the JSON Schema that the API conforms to. In the future, this will be versioned.

    The big part of this week is the introduction of the testing suite and reference client. These are now both available on GitHub and I’d love for you to run them and test out the API. There’s currently one known bug that causes one of the tests to fail, which I’ll be handling in 0.4 due to the large scope of the issue.

    I’m planning to continue work on the test suite this week, due to the large scope of the testing suite. Ideally, I’d like to get up around the 90% mark for code coverage (which I’ve done previously on my Requests library), however I’m not sure as to how coverage can be measured in this case, so I’ll also be investigating this. The coming week will also involve creating a Backbone-based sample theme as a proof-of-concept of real world use. In addition, coming up I’ll be consulting with Max Cutler from the mobile team and ensuring that any possible issues are sorted out at this early stage.

    As always, I appreciate all and any feedback on the project. This week and the next will be boring for you guys in terms of new features as we approach midsemester review, so I’d love you to get out there and break the API. If you can find problems with it, please file them and let me know so I can work them into the testing suite.

  • Ryan McCue 1:57 pm on July 10, 2013 Permalink
    Tags: gsoc, , ,   

    JSON REST API: Version 0.2 

    It’s that time of week again folks (and actually on-time this time)! Version 0.2 of the JSON REST API includes my changes from the past week, including:

    • Allow all public query vars to be passed to WP Query – Some private query vars
      can also be passed in, and all can if the user has edit_posts
      permissions (#311)
    • Pagination can now be handled by using the page argument without messing
      with WP Query syntax (#266)
    • The index now generates links for non-variable routes (#268)
    • Editing a post now supports the If-Unmodified-Since header. Pass this in to
      avoid conflicting edits (#294)
    • Post types and post statuses now have endpoints to access their data (#268)

    You can also view all changes if that’s your style.

    As you can see, it’s a bit of a quiet week in terms of new features, but with the exception of revisions, attachments, and comments, the post API is now considered feature complete. Implementers can now expect that there won’t be any major changes to the post API.

    Since you’ve all been so great, I’ve thrown in a bonus for this week. I’ve created a small proof-of-concept of extending the API for a multisite installation, which is now available via GitHub. Keep in mind that this is just a proof-of-concept, so it doesn’t have too much implemented. (This is also not covered under the scope of the GSOC project, so pull requests are most welcome!)

    In the next couple of weeks, development will be focused around creating tests and example implementations. While this is occurring, I plan to also implement commenting, which was not in the original scope, but is still fairly important.

    As always, feedback is welcome!

  • Ryan McCue 1:59 pm on July 2, 2013 Permalink
    Tags: gsoc, , ,   

    JSON REST API: Version 0.1 

    It’s time for the first weekly release of the API plugin for everyone to sink their teeth into. This post comes to you a few days late, as I’ve unfortunately been a bit sick during the week.

    You can either install it from GitHub or from WordPress.org.

    Here’s what’s changed since the pre-GSoC version:

    • Enable the code to be used via the plugin architecture (now uses rewrite rules if running in this mode)
    • Design documents are now functionally complete for the current codebase (#264)
    • Add basic writing support (#265)
    • Filter fields by default – Unfiltered results are available via their corresponding *_raw key, which is only available to users with edit_posts (#290)
    • Use correct timezones for manual offsets (GMT+10, e.g.) (#279)
    • Allow permanently deleting posts (#292)

    You can also check out the full changelog if you’re interested.

    Astute observers amongst you will notice that the main collection parts (#266, #267) are missing from this release; I’m slightly behind on the release process due to just finishing up final exams and illness. Don’t worry though, I preplanned for this by allowing myself a buffer week before the midsemester deadline.

    Feedback is very welcome!

compose new post
next post/next comment
previous post/previous comment
show/hide comments
go to top
go to login
show/hide help
shift + esc
Skip to toolbar