Hello,
I'm building out an API to interface with our Moodle but am having some issue getting all the courses with the core get_courses method.
Looking at the API interface the value of the return for the core_course_get_courses has this:
courseformatoptions:
name string
value string
But the data being returned from the API actually uses integers for the "value" field most of the time. However, there are cases where the course format option is a default option in the /course/edit.php?id=<courseID>
And the same values without the mouse-over info
And when the data is returned as a full JSON object from the server it has the form:
Which is a combination of int and strings. When the default value is used, there are "-" instead of integer values. I'm struggling to get this deserialized properly into C# classes due to this inconsistency.
How do I get around this?
Or How do I get the default values to take on their integer form instead of the "-". The instructions specifically state to use a dash there when you want to use the defaults.
An additional note, this particular course has a bunch of other fields that use the default values; however, the value in the JSON is the int 0 for those defaults.
For example:
This JSON
Has this default setting:
Any help is greatly appreciated!
core_course_get_courses return field courseformatoptions has wrong data type
از Rob Lamb در
Number of replies: 0