Skip to:
Content
Pages
Categories
Search
Top
Bottom

OpenSocial for BuddyPress


  • Carl Hall
    Participant

    @thecarlhall

    I’d like to implement the OpenSocial API for BuddyPress. Is there any functionality of BuddyPress that is exposed via REST or some other external integration point? The implementation needs to live in the Shindig server that I’m testing with, so I’m looking for any integration points that are available outside of the WP/BP web server process. Are these things I will need to add myself?

Viewing 11 replies - 1 through 11 (of 11 total)
  • You will need to add such things to BuddyPress, yes. If you come up with any good patches for core, I’d love to look at them.


    Carl Hall
    Participant

    @thecarlhall

    Thanks for the reply, Paul. I’ll try to learn the API to BP well enough to offer some patches related to service endpoints. I prefer to use REST. Do you have any suggestions or preferences?


    Boone Gorges
    Keymaster

    @boonebgorges

    Hey Carl – Here are a couple considerations.

    – WordPress (which BP runs on top of) already has support for XML-RPC. Here’s the spec: https://codex.wordpress.org/XML-RPC_wp Of course, the details of this spec are not much good for BuddyPress, since for the most part, BuddyPress data objects are different from WP data objects. But the gateways are already there for working with XML-RPC.

    – That said, the kind of system-to-system talking that would be appropriate for BP would be much better suited to the simplicity of a REST gateway (as opposed to the generally one-to-one, client-to-server relationship that WP’s XML-RPC support was built for – eg the use case of native Android apps communicating with a WP installation).

    – Neither WP nor BP has anything built in for REST support, so you’ll be starting with a clean slate (that is both good news and bad news!). There have been a few add-ons that might be good places to start. The one I’ve used in the past is called WP-RESTful https://wordpress.org/extend/plugins/wp-restful/. It’s a nice plugin, but it also has a huge amount of overhead, in particular with a full implementation of oAuth.

    – In the very simplest terms, the very easiest way to set up a REST endpoint in WP is to intercept a certain kind of URL query and interpret the POST data. Here is about the most stripped down API possible:
    `function bbg_api_listener() {
    global $wp;

    if ( $r = $wp->request ) {
    $ra = explode( ‘/’, $r );
    if ( $ra[0] == ‘restserver’ ) {
    // Do some stuff with the $_POST
    die();
    }
    }
    }
    add_action( ‘wp’, ‘bbg_api_listener’, 1 ); // Ensure that the request is parsed before any WP front-end stuff, but after the core of WP is loaded`

    In this case, I am assuming that requests will go to example.com/restserver. From there it’s a matter of unpacking the POST action, etc.

    – As for outgoing requests, WP has a pretty nice built-in HTTP library called WP_Http. Here is a nice tutorial: http://planetozh.com/blog/2009/08/how-to-make-http-requests-with-wordpress/ It’s a wrapper for cURL with some graceful fallbacks.

    – For something to go into the core of BuddyPress it needs to be really flexible, especially in terms of authorization (this is part of the problem with WP-RESTful and its reliance on oAuth). Keep that separation in mind when you’re crafting something.

    Can’t wait to see what you come up with. As you know, I’m really interested in this project and will be excited to play along.


    modemlooper
    Moderator

    @modemlooper

    Drool REST api :)


    Boone Gorges
    Keymaster

    @boonebgorges

    Yeah, @modemlooper what are you using for your iPhone app in the absence of REST? Or are you requiring a BP plugin to make it work?


    modemlooper
    Moderator

    @modemlooper

    @boonebgorges BuddiPhone is actually a BP component plugin. It creates a slug /mobile. I would love to use REST and make it native, then I could use the hardware – image uploads – contact lists etc. I messed with this plugin a bit https://wordpress.org/extend/plugins/json-api. BuddyPress json post / get would be killer.


    Boris
    Participant

    @travel-junkie

    I’ve been thinking about writing a general RESTful API plugin, but haven’t had the time to start so far. My events plugin already supports getting event information and posting events in xml/json format. The next step is to send invitations and such and for that user information would be required, but it doesn’t make sense for an events plugin to handle general things like members. Right now I’m using API keys (with OAuth to come at some point) to check for access rights and that should also be handled by a more general plugin, which other plugins could then plug into.

    Also very interested what you come up with, Carl.


    Carl Hall
    Participant

    @thecarlhall

    Wow, glad to see all the responses. Initial glancing at wp-restful looks pretty good though as Boone points out, I’ll have to keep a close check on oauth in this. It is pluggable which gives me hope of adding some extensions to it for BP. At the very least, I’ll be adding some type of REST support for BP.
    As I work on things, should I continue to update here or is there an issue tracker I should create an issue in?


    Boone Gorges
    Keymaster

    @boonebgorges

    There’s an issue tracker at trac.buddypress.org (same username:pw as you use here), where you should feel free to open tickets for ways that BP needs to be changed in order for your Open Social add-on to work. For more general discussions – when you are talking about extending BP rather than modifying it – this forum is probably a better place. There are certainly more eyeballs here than on Trac.


    TylerDigital
    Member

    @tylerdigital

    Any update on this? I’m also interested in trying to integrate Open Social into a BP install


    meg@info
    Participant

    @megainfo

    Im working in new framework for wordpress+buddyperss for for building web services, the plugin expose functionality of wp and any other plugins installed in wp to other web sites and desktop applications. i will share a beta version soon.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘OpenSocial for BuddyPress’ is closed to new replies.
Skip to toolbar