by Jake Dallimore.
Cheers,
Hi Vitalii,
Firstly, I would only be looking at the official AGS 2.0 specification document: https://www.imsglobal.org/spec/lti-ags/v2p0/#score-publish-service (login is required to view). That has all you need there. That spec also links to the OpenAPI spec for score posting: https://www.imsglobal.org/spec/lti-ags/v2p0/openapi/#/default/Scores.POST. Neither of these list those additional @type and @context fields, so definitely remove those.
Re logging, the short answer is no. Moodle has rather poor debugging within LTI and unfortunately this leads to situations like yours, where it's hard to isolate the problem. The only other option would be to manually debug this using a local Moodle install - provided you have access to that. Then I'd be stepping through the code with breakpoints, etc.
You can see the code responsible for this validation here:
https://github.com/moodle/moodle/blob/27cbb5965ea34dc142a519cfa72be8cdab353156/mod/lti/service/gradebookservices/classes/local/resources/scores.php#L173C1-L186
A quick look at your (original) request and my suspicion would fall on:
Firstly, I would only be looking at the official AGS 2.0 specification document: https://www.imsglobal.org/spec/lti-ags/v2p0/#score-publish-service (login is required to view). That has all you need there. That spec also links to the OpenAPI spec for score posting: https://www.imsglobal.org/spec/lti-ags/v2p0/openapi/#/default/Scores.POST. Neither of these list those additional @type and @context fields, so definitely remove those.
Re logging, the short answer is no. Moodle has rather poor debugging within LTI and unfortunately this leads to situations like yours, where it's hard to isolate the problem. The only other option would be to manually debug this using a local Moodle install - provided you have access to that. Then I'd be stepping through the code with breakpoints, etc.
You can see the code responsible for this validation here:
https://github.com/moodle/moodle/blob/27cbb5965ea34dc142a519cfa72be8cdab353156/mod/lti/service/gradebookservices/classes/local/resources/scores.php#L173C1-L186
A quick look at your (original) request and my suspicion would fall on:
- it can't decode the JSON (due to backslashes). Moodle doesn't add these as part of the exception generation (you can see that here: https://github.com/moodle/moodle/blob/27cbb5965ea34dc142a519cfa72be8cdab353156/mod/lti/service/gradebookservices/classes/local/resources/scores.php#L186), hence my first comment about these being suspect. They could, of course, be added somewhere between Moodle and where you're seeing the error reported in your tool/postman/etc. I can't speak for that.
- the is_user_gradable_in_course() check. Make sure the user "7" is in the course and is a student.
Cheers,