Quantcast
Channel: Web services
Viewing all articles
Browse latest Browse all 2364

mod_data_add_entry cannot insert date values

$
0
0
by Peter Rundqvist.  

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 are 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]="2021-09-22T00:00:00Z"&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:00"&data[5][fieldid]=32&data[5][subfield]=""&data[5][value]="14:00"

Does anyone know what I am doing wrong?

Kind regards,
Peter

Viewing all articles
Browse latest Browse all 2364

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>