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!
”);
$api->set_topic_id( 100 );
$api->create_new_reply();
And topics…
$api->set_author_by_name(’matt’);
$api->set_post_content(”Hello World!
”);
$api->set_forum_id( 10 );
$api->set_topic_title(’Hello World’);
$api->create_new_topic();
{ 1 trackback }
{ 18 comments… read them below or add one }
Wow, that looks really easy (adding topics). Are you going straight to 3.0 after 2.1?
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.
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.
nm. I think I get it. DOH!
hey nice going Matt damn seems like every new feature gets more interesting
So its going to be like the IPB SDK… Exactly how many things will we be able to do?
wow,
this is one of the feature which iam waiting since 1.0
.
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
I’m already working on things using the components system. I can’t wait to work with the API / HTTP-API system, though.
Cool.
Cool. Editing a topic/post will be possible too ? A topic creation will return the topic ID too ?
Excellent thing however
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*
Great. Really Great.
Oh, and perhaps I shouldn’t ask how those trackbacks got there?
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
Looks good, but more API functionality would be useful
this is one of the feature which iam waiting since 1.0
.
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
I’m already working on things using the components system. I can’t wait to work with the API / HTTP-API system, though.
good!
hey nice going Matt damn seems like every new feature gets more interesting
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!