Moodle API

Moodle API

by Sam Blackburn -
Number of replies: 8
Hi, I'm working on an API for moodle in C++.

The API will be in a .dll format and will be available for software developers to write custom moodle clients (I haven't looked much into the server side aspect of it yet).

I am curious if anybody actually needs this or thinks it's a good idea, as i'm getting pretty bored of developing it to be honest.

Here is a picture which shows a small console application I made with my moodle API (You can see I am testing it with moodle.hrc.ac.uk however it has worked with all other moodle websites I have tested as well).
Below is a link to a header file in C++ which shows the small amount of features there are:
Moodle Header
(Of course a lot of the debugging functions in there won't actually be exported in the final build). The TCPClient class is a basic class I created for convenience (which is used for communication with the moodle web server).

Please tell me if you need it as I am really not motivated to complete this...
Average of ratings: -
In reply to Sam Blackburn

Re: Moodle API

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
How exactly are you doing this?

Are you connecting directly to the Moodle DB, and replicating Moodle's PHP code in C++. That sounds like a really bad idea to me.

If your C++ code is calling Moodle web services, then there is nothing wrong with that.
In reply to Tim Hunt

Re: Moodle API

by Sam Blackburn -
I am connecting directly to the web server, the api sends HTTP packets then parses the data it receives back from the web server and returns the information through to the caller, you could think of it as a fake web browser, because the web server just sees it as any other user using moodle.
I know the problem with this is that if people modify their moodle a lot it could cause compatibility issues, but if I got support then I'm sure I could setup a basic template for compatibility with it.
In reply to Sam Blackburn

Re: Moodle API

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
This approach is normally called screen-scraping. It is normally considered to be a nasty hack, but sometimes it is the most expeditious way to get things done.

Would be better to use real web services, when they are available in Moodle 2.0.
In reply to Tim Hunt

Re: Moodle API

by Sam Blackburn -
Yea, I figured it was a nasty hack - guess i'll wait until Moodle 2.0 then, thanks.
In reply to Sam Blackburn

Re: Moodle API

by Brandon Clark -

So if you haven't started you ready to?  I'm interested and we're past 2.2 now.

In reply to Brandon Clark

Re: Moodle API

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

Brandon,

I haven't seen anything about this API, but have you looked at LTI provider that allows links between all sorts of systems?

I don't know if it's what you are looking for, but Gavin Henrick did a great presentation on it at the recent iMoot and I'm sure there's something on his blog you may find useful if you are interested in this. It may have superceded what was originally being talked about here and the need for moodle specific API, I'm not sure?

http://www.somerandomthoughts.com/blog/2012/01/08/review-lti-provider-for-moodle-2-2/

 

Richard

In reply to Richard Oelmann

Re: Moodle API

by Brandon Clark -

Thank you, I wasn't aware of this feature.  Unfortunately it’s still Basic LTI.  Need to look more into this but it show the best promise but if still in Basic LTI what kind of capability do you really have.  This does remind me of StackExchanges API, but I still need more clarity on some topics.

In reply to Sam Blackburn

Re: Moodle API

by Fazia Mack -

.dll is inherantly bug infested programming, I guess debugging will be the challenge you face. Well if you need help in testing stage 

I can spare a few "free minutessmile happy programming!!