[IPB 2.1] API

by Matt Mecham on July 20, 2005

A party inside?
A persons IQ?

Nope. Application Programming Interface. This exciting term encapsulates the ability to interfere with a program without having intimate knowledge of the program’s code. Good idea, I say.

With this in mind, I’ve started work on IPB 2.1’s API. Now, fundamentally IPB has core classes, of which an API layer is wrapped around then and then another layer wrapped around that called ‘HTTP-API’. The HTTP-API wrapper will allow one to fire off commands via the wonders of POST or GET. When correctly configured, you’ll be able to update your member’s signature with a command as insanely easy as “httpapi.php?api=members&-save-signature=hax&id=32&apikey=hilariously
longkeyhere’. This further abstracts one from the realities of getting one’s hands dirty with nasty old PHP code.

However, before we get all carried away with that, we first need a good solid API structure which interfaces with the IPS classes without re-creating too much code. Our utopian fantasy would involve lots of naked women, I mean, it would involve being able to write a whole suite of API classes and then write a framework called IPB that uses them. However, this is still a relatively distant dream simply because the average forum system is one big bad-ass hack. Programming theory and the reality of cramming 350 accounts on a P4 web server don’t often run along the same lines. The average forum system (and indeed, the average web application) takes advantage of several short-cuts to reduce the number of loaded classes and queries. This isn’t ideal but the having your program banned is less desirable.

So, I’ve had to suffer a little duplication. Originally I had planned to make the Posts API directly load class_post.php functions but class_post.php is only really set up to deal with the current logged in member (something that will be addressed in IPB 3.0) and thus not useable. Fortunately, I’ve been able to make use of class_post in other areas, such as topic rebuilding, forum rebuilding, stats rebuilding, topic tracking and forum tracking meaning the only real duplication we have is with the actual data insertion. Good enough until I go through the code during IPB 3.0’s development cycle.

Here’s how easy it is to add a reply to a post:

$api = new api_topics_and_posts();
$api->set_author_by_name(’matt’);
$api->set_post_content(”Hello World! :D ”);
$api->set_topic_id( 100 );
$api->create_new_reply();

And topics…

$api->set_author_by_name(’matt’);
$api->set_post_content(”Hello World! :D ”);
$api->set_forum_id( 10 );
$api->set_topic_title(’Hello World’);
$api->create_new_topic();

{ 31 comments… read them below or add one }

1 Danny July 20, 2005 at 5:31 pm

Wow, that looks really easy (adding topics). Are you going straight to 3.0 after 2.1?

2 Myr July 20, 2005 at 7:09 pm

Great! I’m hoping this simplicity will also apply to checking profiles for information, checking to see if a member’s logged in on the cookie, etc.

3 Anonymous July 20, 2005 at 7:34 pm

Could ye or someone else explain this in simipler terms. I’d probley have to watch a few movies of what your talkin aboout. o and yes I did read the ENTIRE blog entry.

4 Anonymous July 20, 2005 at 7:34 pm

nm. I think I get it. DOH!

5 Will78 July 20, 2005 at 7:56 pm

hey nice going Matt damn seems like every new feature gets more interesting

6 Antony July 20, 2005 at 8:47 pm

So its going to be like the IPB SDK… Exactly how many things will we be able to do?

7 ipbmods.com July 21, 2005 at 2:52 pm

wow,

this is one of the feature which iam waiting since 1.0 :D .

i will use this httpapi for a modification which i plan since a long time, and matt, it will use your new component and module system (yes, you don´t have make this system for nothing ;) .

regards
bernhard

8 Dan July 21, 2005 at 4:21 pm

I’m already working on things using the components system. I can’t wait to work with the API / HTTP-API system, though. :D

9 Kennedy July 24, 2005 at 10:22 am

Cool. :)

10 The Jedi July 25, 2005 at 10:24 am

Cool. Editing a topic/post will be possible too ? A topic creation will return the topic ID too ?

Excellent thing however :)

11 Alahmnat August 3, 2005 at 8:43 am

Matt, I think I might have to kiss you…

*gets ready to throw out most of his hacked-in functionality in favor of API stuff*

12 TheBrain0110 September 14, 2005 at 9:41 pm

Great. Really Great.

Oh, and perhaps I shouldn’t ask how those trackbacks got there?

13 Glen September 22, 2005 at 5:51 am

Sounds cool but a bit over my head….Sounds like you can do really cool stuff with this API but this will be a bit tough for us non-programmers… :) Maybe an “API for Dummies” post in the forum is needed :)

14 Pita November 12, 2005 at 12:42 pm

Looks good, but more API functionality would be useful :)

15 История Египта April 14, 2007 at 3:06 pm

this is one of the feature which iam waiting since 1.0 :D .

i will use this httpapi for a modification which i plan since a long time, and matt, it will use your new component and module system.info

16 George Sorof April 19, 2007 at 5:20 pm

I’m already working on things using the components system. I can’t wait to work with the API / HTTP-API system, though. :D
good!

17 статьи April 19, 2007 at 5:21 pm

hey nice going Matt damn seems like every new feature gets more interesting

18 MajaSaalis June 22, 2009 at 3:35 pm

Tere!

Suitsetan juba 8 aastat, nььd aga otsustasin, et tuleb loobuda sellest! Aitab! Kas kellegil on kogemus, kuidas on kergem seda teha?
Tean mitmeid variante-
tabletid, ehk toidulisandid
plaastrid
nдtsud
!!! Raamat !!! ( Allen Carr vist oli )

Kas on teada veel variante?

Tдnud!

19 Anonymous September 6, 2009 at 2:03 pm

Cheers

When I try to burn a music CD on iTunes it makes this odd clicking sound and doesn’t end up burning the DVDRW.
I tried using the regular drag and drop onto the CD burning folder itself and it still makes this odd clicking noise.
I’m using noname disks and they worked fine when I first got them then all of a sudden it’s doing this.
I’ve tried another brand of disk (esperanza) and it’s still making the same noise…

Recommendations any of you?

_________________
Best

20 Neargosoaguen November 6, 2009 at 11:21 pm

Hey everyone,

Im new to the forum and just wanted to introduce myself, i’m Joseph form UK. I look forward too makeing a contribution here.

21 Xeyibel November 8, 2009 at 3:32 am

Itchlips retorted [url=http://good-hearted.com/tamoxifen-discontinued/]tamoxifen block receptors[/url] evenly faceted [url=http://good-hearted.com/bactroban-cream-picture/]bactroban ointment 2[/url] sand dune [url=http://good-hearted.com/coreg-side-efects/]coreg time release[/url] came into [url=http://good-hearted.com/hydralazine-and-isosorbide/]isosorbide patient assistance[/url] learn quickly [url=http://good-hearted.com/lamictal-and-depakote/]depakote er tab 500mg[/url] was eleven [url=http://good-hearted.com/plavix-and-aciphex/]pravachol ketamine aciphex nasonex aleve[/url] had already [url=http://good-hearted.com/lethal-ambien-amount/]scatton ambien[/url] harpies happen [url=http://good-hearted.com/buy-alesse/]2737 alesse amerimedrx renova ultram[/url] olph concluded [url=http://good-hearted.com/pantoprazole-side-effects/]pantoprazole sodium sex[/url] continue under [url=http://good-hearted.com/aldara-cancer-piel/]aldara buy[/url] great and [url=http://good-hearted.com/vardenafil-dosing/]drug prescription vardenafil[/url] the sort [url=http://good-hearted.com/aphthasol-paste/]aphthasol overnight delivery[/url] rampaging onward [url=http://good-hearted.com/prevacid-info/]prevacid patient insert[/url] pinning her [url=http://good-hearted.com/wellbutrin-heart-damage/]wellbutrin with cymbalta[/url] erwin had [url=http://good-hearted.com/symmetrel-100-mg/]symmetrel drug[/url] cfuufs gfudi [url=http://good-hearted.com/b-ultram/]effects of snorting ultram[/url] that desk [url=http://good-hearted.com/methamphetamine-manufacturing/]methamphetamine pim[/url] solid wall [url=http://good-hearted.com/minocycline-and-autism/]children minocycline[/url] biological laboratory [url=http://good-hearted.com/prescribed-glyburide-5-mg/]sporanox and glyburide[/url] skull warned [url=http://good-hearted.com/sarafem-and-pmdd/]fluoxetine vs sarafem[/url] have made [url=http://good-hearted.com/cost-of-evista-cost-didrex/]didrex cheap overnight delivery[/url] must search [url=http://good-hearted.com/weight-gain-on-prevacid/]prevacid versus nexium[/url] grappling hooks [url=http://good-hearted.com/sertraline-breastfeeding/]about sertraline[/url] aversion for [url=http://good-hearted.com/penicillin-use-in-pregnant-ovine/]penicillin resistant gonorrhea[/url] dashed back [url=http://good-hearted.com/buspar-anti-anxiety/]side effects for buspar[/url] they kissed [url=http://good-hearted.com/uses-for-antivert/]antivert shelf life[/url] surfaces and [url=http://good-hearted.com/novo-pravastatin-40-mg-side-effects/]nova pravastatin[/url] exact nature [url=http://good-hearted.com/alesse-21-tablet/]prices alesse[/url] will like [url=http://good-hearted.com/atarax-is-used-for/]what is atarax[/url] was determined [url=http://good-hearted.com/cartia-x-2/]cartia xl mg[/url] undermine him [url=http://good-hearted.com/generic-valtrex-cplt/]herpes add valtrex[/url] were close [url=http://good-hearted.com/tazorac-reviewsa/]tazorac cream used for[/url] some few [url=http://good-hearted.com/lotrisone-scherring-plough/]lotrisone[/url] hex tucked [url=http://good-hearted.com/is-cozaar-generic/]generic for cozaar[/url] because children [url=http://good-hearted.com/teen-use-of-lsd/]lsd and the cosmic game[/url] hurled the [url=http://good-hearted.com/men-with-sexual-dysfunction-hypertension-losartan/]losartan potassium cozaar side effects[/url] arnivorous grass [url=http://good-hearted.com/is-singulair-a-oxidase-inhibitors/]singulair woman[/url] admit mat [url=http://good-hearted.com/glc-analysis-meclizine-hydrochloride-tablet/]merazine versus meclizine[/url] magic mirror [url=http://good-hearted.com/zestril-and-pregnancy/]zestril 2.5 mg[/url] tiny chamber [url=http://good-hearted.com/order-butorphanol-tartrate-without-a-prescription/]butorphanol stadol[/url] gave him [url=http://good-hearted.com/ditropan-ejaculate/]ditropan xl 15mg[/url] out its [url=http://good-hearted.com/ritalin-buy-online-no-prescription/]ritalin weight loss[/url] aturally the [url=http://good-hearted.com/norvasc-hemodialysis/]norvasc side affects[/url] not chance [url=http://good-hearted.com/losartan-for-dogs/]losartan and hydroclorotiazide[/url] even tell [url=http://good-hearted.com/viagra-and-dopamine/]viagra sideaffects[/url] researched the [url=http://good-hearted.com/keflex-antibotic/]keflex sinus[/url] never mentioned [url=http://good-hearted.com/tougera-ultravate/]ultravate aquafore[/url] forget their [url=http://good-hearted.com/tretinoin-clindamycin-acne/]photochemical proses in tretinoin[/url] small bare [url=http://good-hearted.com/side-affects-of-glyburide/]glyburide loses effectiveness at high doses[/url] swim through [url=http://good-hearted.com/preven-and-endometriosis/]rabies dogs shot preven[/url] what his bending.

22 LabcapeWranna November 12, 2009 at 3:32 pm

Hey guys and girls alike! This is my first post here, but I plan to contribute more later. :)

Anyway, I’m starting a holiday season weightloss blog dedicated to Acai Berry! =) I will constantly be updating the blog with more and more special Acai Berry deals! (So exciting, heh!)

The website is: http://acaiberrydiscounts.blogspot.com

I look forward to getting to know all of you! =)

23 datojafetut November 21, 2009 at 12:47 pm

Hello this is just a random topic. No worries!

24 zinymegan November 24, 2009 at 5:30 am

Hey Guys,

I am a student (limited budget) and have seen a few offers for free ipods and iphones. Does anyone Know if any if the free IPhone or Ipod offers are actually legit? I don’t want to waste my time filling out a hundred surveys and was hoping to hear from someone who may have had some success with this.

Thanks

25 marthafines December 24, 2009 at 8:45 pm

Merry Christmas to all… and to all a good night.

26 beemBreen December 26, 2009 at 1:03 am

Hi Guys,
Just stumbled upon this site. It looks cool and I think I will be having a good time over here.

Welcome me :)

27 FaltAnepeat December 26, 2009 at 8:37 pm

test222 reaspolurevedazaser

28 Brieradag January 1, 2010 at 7:50 am

anyone else starting to have trouble sleeping yet? my mam says it’s nature getting me ready for the hundreds of sleepless nights coming my way lol! i need to pee like 8 times a night lol could sleep all day and it still doesn’t seem long enough!

29 teella January 7, 2010 at 7:16 am

hallo,

ich hoffe hier im Forum kann mir jemand helfen!
Ich habe aus versehen 27 Pics von meiner Kamera gelöscht. Leider sind die Daten nicht mehr im meinem Papierkorb.
Die Daten sind sehr wichtig für mich! Ich würde die gerne retten.
Wer kennt ne Seite auf der ich Infos dazu finde, wie ich die Daten retten kann??

Vielen Dank schonmal für eure Antworten

danke

30 Sach January 8, 2010 at 9:21 am

Hello Matt,

I am running Invision Power Borad 3.0 and I was looking for an API which I can use to power my other web application on same domain where I am having IPB board forum installed. I searched on net and found this page. Could you please help me out, I read above that you were working on such API to access IPB’s resources like, posts, members profile data etc. Could you please tell me if you had developed such API? Could you please provide the code?

Thanks in Advanace.
Sach

31 metevErveramp January 15, 2010 at 6:32 am

Hi All!

Did You make any new years resolutions?

Bye For Now!!!

Miss R. Plumlee

Leave a Comment

{ 1 trackback }

Previous post: Busy Week

Next post: [IPB 2.1] Template Set Differences