Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Not a bug
-
3.11.1
-
None
-
MOODLE_311_STABLE
Description
Hi,
I have a mod_data activity in a course. I'm using the REST API to add entries to this activity. One of the fields is of type "date":
{
"id": 27,
"dataid": 11,
"type": "date",
"name": "Kurstillfälle",
"description": "",
"required": true,
"param1": "",
"param2": "",
"param3": "",
"param4": null,
"param5": null,
"param6": null,
"param7": null,
"param8": null,
"param9": null,
"param10": null
}
When using mod_data_add_entry posting new entries all fields get their values, except the date field described above. I have tried to format the date value being submitted in various ways (unix style, unix style json encoded, raw date value, raw date value json encoded and various string variants of the date value) without any luck - the value simply doesn't get stored in the record...
The POST request looks like this:
https://{{Server}}?wstoken={{ServiceKey}}&wsfunction=mod_data_add_entry&moodlewsrestformat=json&databaseid=11&groupid=145&data[0][fieldid]=27&data[0][subfield]=""&data[0][value]="1631750400"&data[1][fieldid]=29&data[1][subfield]=""&data[1][value]="Tellus"&data[2][fieldid]=28&data[2][subfield]=""&data[2][value]="10"&data[3][fieldid]=30&data[3][subfield]=""&data[3][value]=5&data[4][fieldid]=31&data[4][subfield]=""&data[4][value]="13:0"&data[5][fieldid]=32&data[5][subfield]=""&data[5][value]="14:0"
Kind regards,
Peter