MyBB Community Forums

Full Version: RESTful API System Development - need your ideas
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hey all,

I'm currently developing an API System for MyBB that allows foreign systems (written in any programming language) to interact with MyBB.
I intend to make this look kinda "official", here are some previews from the plugin :

- First, you activate the plugin :
[Image: 295289capture1.png]

- Then you configure it if needed (note I didn't yet finish the configuration settings) :
[Image: 288809capture2.png]

- The plugin creates a sub menu that allows you to enable / disable a specific API that you don't want to expose, add / edit / regenerate / delete an API key :
[Image: 711211capture3.png]
[Image: 172898capture4.png]
[Image: 920470capture5.png]

- Then the API starts responding to your requests as follows :
mybb/api.php?action={API_NAME}&output={OUTPUT_FORMAT}&apikey={API_KEY}

You got it, you can choose whether to output the result in JSON / XML / Text and you can even create your own output format it's REALLLLLLY easy.
[Image: 843122capture6.png]

The API system is easily extensible, you can easily create your own APIs, I won't detail this now as I might change the process, but I intend on deploying the RESTful API System plugin really soon.

What I need :
- What APIs should I create? I thought of creating APIs about everything. So any thoughts would be welcome Big Grin
Cool stuff. Smile

Resources for users and threads would be nice to begin with.

Also, the API key and the output format should be sent as HTTP headers rather than in the URL.
(2014-08-13, 12:03 PM)Fábio Maia Wrote: [ -> ]Cool stuff. Smile

Resources for users and threads would be nice to begin with.

Also, the API key and the output format should be sent as HTTP headers rather than in the URL.

Oh that would be nice, it could even be a configuration option (HTTP Header / URL Parameter) that by default is set to HTTP Header.

I also need to know if it would be better to use a new file named api.php?parameters, or hook the API on misc.php?action=api&parameters . What do you think is the wise choice?
(2014-08-13, 12:08 PM)TheGarfield Wrote: [ -> ]
(2014-08-13, 12:03 PM)Fábio Maia Wrote: [ -> ]Cool stuff. Smile

Resources for users and threads would be nice to begin with.

Also, the API key and the output format should be sent as HTTP headers rather than in the URL.

Oh that would be nice, it could even be a configuration option (HTTP Header / URL Parameter) that by default is set to HTTP Header.

I also need to know if it would be better to use a new file named api.php?parameters, or hook the API on misc.php?action=api&parameters . What do you think is the wise choice?

I think the best option will be additional setting for it, but honestly api.php would be way better Toungue
A few of us had already built an API framework but it stalled out last year.  it is 100% URI based, for example

http://domain.com/api/v1/post/123

Supports adding new, deleting, reading one or more posts, thread, users. Getting forums, Logging in remotely, etc. all via CURL. Also has multiple authentication methods/limits, such as password based, IP restrictions, etc.

Whole thing is modular so "posts" namespace is a separate chunk of code from the "threads" namespace but all the  URI requests go though a single set of core files which parses the request and loads the appropriate module.

Unfortunately real life impacted all of us.
You guy should consider releasing the source somewhere, let people build on it Wink
(2014-08-13, 04:44 PM)pavemen Wrote: [ -> ]A few of us had already built an API framework but it stalled out last year.  it is 100% URI based, for example

http://domain.com/api/v1/post/123

Supports adding new, deleting, reading one or more posts, thread, users. Getting forums, Logging in remotely, etc. all via CURL. Also has multiple authentication methods/limits, such as password based, IP restrictions, etc.

Whole thing is modular so "posts" namespace is a separate chunk of code from the "threads" namespace but all the  URI requests go though a single set of core files which parses the request and loads the appropriate module.

Unfortunately real life impacted all of us.

Real life is a wicked old witch Big Grin

Mine doesn't look as fancy as the one you described, I prefered using "URL Parameters" to receive data rather then in the URL Path /like/this/one, because I thought once you have an API that needs 10 parameters you'll get lost in between the slashes, moreover, when some parameters are optional you'd get nauseous Smile

But I'll be glad to take your built up API framework to give it a look and get inspiration from that if you'd like to do that Smile

(2014-08-14, 01:14 AM)Cameron:D Wrote: [ -> ]You guy should consider releasing the source somewhere, let people build on it Wink

(2014-08-14, 01:14 AM)Cameron:D Wrote: [ -> ]You guy should consider releasing the source somewhere, let people build on it Wink

Hey Cameron, are you talking about my code? I'd really like to release the code when it's ready, and then people can fork it and start working on branches, BUT knowing that there is a stable version somewhere Smile
Was talking about pavemen's post. I'd love an API sort of thing, I currently have a few users who just scrape the HTML pages and extract the content so they'd love an API.
@Cameron Pavemen's code is on BitBucket, though I'm not sure if it's public.
User information
Thread information
Forum display thread listing
Index forums and categories
Pages: 1 2 3