I’m currently trying to write data from the app into the database. I’m using the web service for this.
However, I get the following error message and the documentation is, in my opinion, very sparse.
core_externalexternal_multiple_structure::__ construct(): Argument #1
($Content) must be of type core_externalexternal_description, array
given, called in
The relevant line is the following:
'eintraege' => new external_multiple_structure([
The complete function is:
public static function execute_returns(): external_single_structure {
return new external_single_structure([
'eintraege' => new external_multiple_structure([
'fach' => new external_value(PARAM_INT, 'FachID'),
'datum' => new external_value(PARAM_RAW, 'Datum des Eintrags'),
'ustdbis' => new external_value(PARAM_INT, 'USTD bis'),
'ustdvon' => new external_value(PARAM_INT, 'USTD von'),
'eintrag' => new external_value(PARAM_TEXT, 'Eintrag'),
])
]);
}
I would be very grateful for any help and thank you very much for that!
I tried the following variations:
`A parameter can be described as:
a list => external_multiple_structure
an object => external_single_structure
a primary type => external_value`
As described here:
https://moodledev.io/docs/4.5/apis/subsystems/external/writing-a-service