Webservices

dboggs1994

New Member
I am attempting to use the webservices list plug-in, reviewed the 2015 tutorial (the one with no sound-or maybe it is my system blocking flash). Anyway the example provided is based on the JSON being returned to contain the object, which in my case only the array is the return. The correct number of records are returned, from the restapi call, but the values being returned are not populating into the mapped fields. So I am assuming that an object needs to be returned so I can tell where the starting point is? The API being used provides standard functions that I have to use so if this plug-in requires an object I will need to approach this another way.

Partial JSON Response for structure
[
{
"id": 1,
"shortname": "Development",
"categoryid": 0,
"categorysortorder": 1,
"fullname": "Local Development",
"displayname": "Local Development",
"idnumber": "",
"summary": "",
"summaryformat": 1,
"format": "site",
"showgrades": 1,
"newsitems": 6,
"startdate": 0,
"enddate": 0,
"numsections": 1,
"maxbytes": 0,
"showreports": 0,
"visible": 1,
"groupmode": 0,
"groupmodeforce": 0,
"defaultgroupingid": 0,
"timecreated": 1523448641,
"timemodified": 1532542403,
"enablecompletion": 0,
"completionnotify": 0,
"lang": "",
"forcetheme": "",
"courseformatoptions": [
{
"name": "numsections",
"value": 1
}
]
},
{
"id": 2,
"shortname": "SubCourse 1",
"categoryid": 1,
"categorysortorder": 10004,
"fullname": "SubCourse 1",
"displayname": "SubCourse 1",
"idnumber": "",
"summary": "",
"summaryformat": 1,
"format": "topics",
"showgrades": 1,
"newsitems": 5,
"startdate": 1523505600,
"enddate": 1555041600,
"numsections": 4,
"maxbytes": 0,
"showreports": 0,
"visible": 1,
"hiddensections": 0,
"groupmode": 0,
"groupmodeforce": 0,
"defaultgroupingid": 0,
"timecreated": 1523449531,
"timemodified": 1535726544,
"enablecompletion": 1,
"completionnotify": 0,
"lang": "",
"forcetheme": "",
"courseformatoptions": [
{
"name": "hiddensections",
"value": 0
},
{
"name": "coursedisplay",
"value": 0
}
]
 
I'm not sure if it's work as an array or not. Although if it currently doesn't, look at the code it'd be easy enough to cast the array to an object where we read the web service data.

But I can't really test this without running it against your data source. I don't have any examples to hand of services that return arrays of objects.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top