"Missing required key in single structure: courses"

"Missing required key in single structure: courses"

by Alik Wansiedler -
Number of replies: 2

Hello everyone!
I've created a custom webservice which allows my api.user to create courses using the "core_course_create_courses" function.

HTTP-Request:
POST https://{URL}/webservice/rest/server.php?wstoken {post_wstoken}&wsfunction=core_course_create_courses&moodlewsrestformat=json

Body:
[

   {

        "id": ,
        "shortname": "",
        "categoryid": ,
        "categorysortorder": ,
        "fullname": "",
        "displayname": "",
        "idnumber": "",
        "summary": "",
        "summaryformat": ,
        "format": "site",
        "showgrades": ,
        "newsitems": ,
        "startdate": ,
        "enddate": ,
        "numsections": ,
        "maxbytes": ,
        "showreports": ,
        "visible": ,
        "groupmode": ,
        "groupmodeforce": ,
        "defaultgroupingid": ,
        "timecreated": ,
        "timemodified": ,
        "enablecompletion": ,
        "completionnotify": ,
        "lang": "",
        "forcetheme": "",
        "courseformatoptions": [
            {
                "name": "",
                "value": 
            }
        ]
    }
]

Average of ratings: -
In reply to Alik Wansiedler

Re: "Missing required key in single structure: courses"

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Sorry - I'm not sure what the question is?
In reply to Alik Wansiedler

Re: "Missing required key in single structure: courses"

by Benjamin Ellis -
Picture of Particularly helpful Moodlers
Hi,

Not sure wht you asking but broken pattern in your body @

"format": "site",


Seems like it should be

"format": ,
"site":,

Might help 🤷‍♂️