by Jock Coats.
Funnily enough, no!
There are a couple of different ways different apis work, and I had forgotten that Moodle ones don't expose everything on the url, but carry their parameters in the body of the request.
The closest I can get is to show you the "request body" of one I've been playing around with this morning (which is not a publiic moodle api but one we've written but the principle is the same - you sent a token to tell it who you are, a function you want it to carry out and then whatever parameters that particular function needs to work:
moodlewsrestformat:json
wstoken:{{moodle-housekeeping-token}}
wsfunction:local_obu_assessment_extensions_external_award_exceptional_circumstance
studentidnumber: 9999999
extensiondays:14
groupidnumber:2024.ZZZZ9999_S1_1_202409_75653_CWS1WEEK13-3_68559_OE
And you send that to /webservice/rest/server.php
I run most of mine from inside local php scripts where I can compare data from one system with moodle and send some change based on the differences. So yeah, for the most part you need someone able to write the equivalent of that script (either on a middleware machine or potentially on the machine that is the source of the data you want to send or retrieve from Moodle).
A great tool to get familiar with (more familiar than me - I always forget - hence working all morning to get something right - how to format the requests) as called "PostMan". Which would allow you to explore your Moodle apis and see what they return if they are getting data - which you might then use to send to another api on the system you want to update, or vice versa to see how to put things into moodle perhaps as a result of a prior query or api call to the system you want as your source for changes.
So, for instance, at the moment I use Moodle apis, mostly after querying an Oracledatabase from our student records system, to update some course details if they change dates in the SRS, to update student records in Moodle (usually profile fields), to move courses between categories, to create metalinks automatically, to create an populate groups in courses based on our timetabling system and so on. But that's all just scratching the surface really!
If we had the time, for instance, we could watch for course leaders changing our course template and reverse what they had changed to really annoy them![smile smile]()
Many, but by no means all, third party plugins often have their own api "endpoints" so, say, you could pull grades from moodle assignments and transfer them to your student record system, and it is basically infinitely extensible (and I understand getting easier to do though I haven't really fully understood how the new recommended way of doing it is. But we wrote one that takes some of the functions of the mod_attendance module and exposes them so that our timetabling system can set up moodle attendance sessions for timetabled classes and so on.
Cheers,
Jock
There are a couple of different ways different apis work, and I had forgotten that Moodle ones don't expose everything on the url, but carry their parameters in the body of the request.
The closest I can get is to show you the "request body" of one I've been playing around with this morning (which is not a publiic moodle api but one we've written but the principle is the same - you sent a token to tell it who you are, a function you want it to carry out and then whatever parameters that particular function needs to work:
moodlewsrestformat:json
wstoken:{{moodle-housekeeping-token}}
wsfunction:local_obu_assessment_extensions_external_award_exceptional_circumstance
studentidnumber: 9999999
extensiondays:14
groupidnumber:2024.ZZZZ9999_S1_1_202409_75653_CWS1WEEK13-3_68559_OE
And you send that to /webservice/rest/server.php
I run most of mine from inside local php scripts where I can compare data from one system with moodle and send some change based on the differences. So yeah, for the most part you need someone able to write the equivalent of that script (either on a middleware machine or potentially on the machine that is the source of the data you want to send or retrieve from Moodle).
A great tool to get familiar with (more familiar than me - I always forget - hence working all morning to get something right - how to format the requests) as called "PostMan". Which would allow you to explore your Moodle apis and see what they return if they are getting data - which you might then use to send to another api on the system you want to update, or vice versa to see how to put things into moodle perhaps as a result of a prior query or api call to the system you want as your source for changes.
So, for instance, at the moment I use Moodle apis, mostly after querying an Oracledatabase from our student records system, to update some course details if they change dates in the SRS, to update student records in Moodle (usually profile fields), to move courses between categories, to create metalinks automatically, to create an populate groups in courses based on our timetabling system and so on. But that's all just scratching the surface really!
If we had the time, for instance, we could watch for course leaders changing our course template and reverse what they had changed to really annoy them
Many, but by no means all, third party plugins often have their own api "endpoints" so, say, you could pull grades from moodle assignments and transfer them to your student record system, and it is basically infinitely extensible (and I understand getting easier to do though I haven't really fully understood how the new recommended way of doing it is. But we wrote one that takes some of the functions of the mod_attendance module and exposes them so that our timetabling system can set up moodle attendance sessions for timetabled classes and so on.
Cheers,
Jock