Moodle API - accepted input format

Moodle API - accepted input format

by Maxime Paintendre -
Number of replies: 2

Hi all,

I am currently working on the implementation of the Moodle API. 

For testing purposes and for further development, I would like to know what formats are supported by the API in input.

I have seen from the tests that we can request in get via query params, but when we want to send data, what format can we use?

Via postman, I managed to post data via `form-data` and `x-www-form-urlencoded` but can we also send JSON directly? 

I tested but for the moment without success.

thanks in advance.


Average of ratings: -
In reply to Maxime Paintendre

Re: Moodle API - accepted input format

by Francis Devine -
Picture of Core developers
Hi Maxime, the default supported data for the rest endpoint is as far as I know, only form-data, x-www-form-urlencoded.

There is also a SOAP endpoint and XML-RPC (both the ZEND implementations)

Personally I'd recommend https://github.com/catalyst/moodle-webservice_restful

I'm biased though, since this was written by my colleagues in our australian office.

This brings the webservices experience much closer to what more traditional REST endpoints look like and is easier to approach (at least in my opinion)


In reply to Francis Devine

Re: Moodle API - accepted input format

by Maxime Paintendre -
Hi Francis,
thanks for your answer.
I had actually seen this plugin but I didn't think it was compatible with my version (3.11).
So I'll test this one.
Thanks again.