RESTful API use cases

Hi all,

I am close to completing my hypeGraph plugin, which is a fully RESTful API provider for Elgg. 

I am currently working on defining more consumption endpoints, and I would like to find out if there are any use cases that I should take into consideration. I believe this will be a good starting point for mobile Elgg clients, as well as outsourcing more of the rendering work to the browser.

Ultimately, I am planning to build a JS and PHP clients to go with the plugin, as well as a GUI for testing.


  • Looks very cool.

    How would you feel about structuring arrays like so?

    "0": {},
    "1": {},
    " length": 12345,

  • Yep, need to think about output arrays a bit more. I guess it will be ironed out once I start working with real-life consumers.
    What does 'length' represent?

  • The total size of the list. If you have an offset of 10, for example, then you'd get back:

    "10": {},
    "11": {},
    "length": 12345

  • Hi Ismayil,

    I like this Idea. But I have a question what is the difference between "plugin your creating"and the plugin already in elgg. I am using elgg 1.8.16 webserivce plugin in one of my mobile project. and planing to update to new elgg.  I have created a Android APP and is fetching data of the blog from elgg web-service plugin.

    I am using elgg as back-end to post blog on my app. now i am planing to add comments on my app. but not sure how to start. I am not very good with wbeserive recently i started working on this . So if you can add comments part in your web-service plugin if would be great. in short i like to have profile option in webserice so it can be used in mobile apps. 

    Can i try your webservice plugin on production or still this is on beta. 


  • My goals for the plugin were:
    - to create a RESTful service
    - to standardize/nornalize API output data
    - reduce the overhead for adding new endpoints
    These were the pain points that made core webservices unusable in my projects. I am currently deploying this on 3 pre-production sites, we are uncovering some bugs that will get fixed. I would say it's almost production ready, but like with any plugin, do your testing and security audit first.
    There are already endpoints for working with blogs and comments, so you can give it a try.

  • adc

    Great work! What do you think about using an open source solution to build RESTful API such as Dreamfactory @Ismayil? I am looking for a solution to create api for a different project and would very much welcome your views, if you would be so kind please?

  • Hi Ismayil,

    There is issue in the webserivce. If anyone hit API using any load testing tools. there is no way to stop them. they can easily increase the load on server by just hitting webservice URL. even if I create a JS which hit this API webservice in infinite loop there should we some option so that

    API, block that IP which is trying to hit this web-service unnecessary. Can you help on this.

    Thanks .. 

  • @ewinslow, I have implemented your suggestion.

    @coolmatescomltd, never used Dreamfactory, but it seems unnecessary to create another layer. Why give thrid parties access to your data, when you can serve everything right from Elgg?

    @sagrawal2002 If I were to kill an Elgg site with a DoS attack, I wouldn't choose web-services as an attack point... What prevents anyone from hitting your landing page in an infinite loop?

  • adc

    True. Except the other projects I was thinking about were not elgg.:-)

  • @sagrawal2002, you can stop someone who is hammering your site in an infinite loop by using this plugin

    Elgg hammer never fails because it checks how long it's been since that client's last request. The thing is, during the entire time your site is live for months or years,  Elgg Hammer will be dutifully screening all the requests; even over three million  requests a day; and will not miss bad guys a beat!

    Give it a shoot.