I'm trying to set up a webpage that communicates with a Moodle page. I need different data from a database activity and want to create new entries. Note that I am not talking about the SQL database in BG, it is the activity database in courses.
The information should be retrieved/transferred via the REST API, an HTML POST Request. My problem is that I don't know how to add a new record to the database activity because I cannot transfer the data array. Only the first parameter given appears in my database.
E.g. i tried ...&wsfunction=mod_data_add_entry&databaseid=10&data[fieldid]=66&data[value]=12&data[fieldid]=67&data[value]=test
And many other combinations. Always only the first parameter is shown in the database. The docs tell me this (Pseudocode):
//The fields data to be created
list of (
fieldid int //The field id.
subfield string Default to "" //The subfield name (if required).
value string //The contents for the field always JSON encoded.
REST (POST parameters)
I cannot find anywhere else something called a "subfield".