-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
no responseJson on getAll lineItem request from context #41
Comments
Hard to tell what might be causing this. What response are you getting from the method? What responses are received from the 5 HttpMessage requests being made? Have you tried making a request without the second parameter ('Essay'), or without either parameter, to see if this makes any difference? |
I am getting a blank return from the method. The 3 GET requests responses are set ok to 1, status 200 and the lineitems that are present in moodle are showing as [argv] => Array ([<<lineitems id, label, scoreMaximum, resourceId, tag>>]) The 2 POST requests are also showing as ok 1 status 200 and are grant requests authorisation using bearer tokens I have tried your suggestion of removing both parameters and still the same. |
Thanks for the details. Since you are getting 200 responses perhaps the issue is with the platform? Are these calls working for any other platforms or contexts? |
I have print_r the http message from with the do while loop of getAll from service/lineItems.php the response does not have ok set when it is returned from the HttpMessage send request. Could this be related to the fact there are 5 requests being made at once. If i print_r $message->ok I get 11111 |
If getAll is returning an empty array it should mean that no errors were encountered. Try printing the whole of the HttpMessage objects to see the actual responses received from the platform. Are you sure there should be some line items? Have you created any using the LineItem service for the same context? Have you tried using a different platform? |
ceLTIc\LTI\Http\HttpMessage Object ( [ok] => [request] => [requestHeaders] => GET /mod/lti/services.php/3/lineitems?type_id=4 HTTP/2 Host: domain-name Authorization: Bearer token set Accept: application/vnd.ims.lis.v2.lineitemcontainer+json [response] => Array ( [REDIRECT_UNIQUE_ID] => unique_ID [REDIRECT_DOCUMENT_ROOT] =>root/htdocs/moodle [REDIRECT_HTTP_AUTHORIZATION] => Bearer token set [REDIRECT_HTTPS] => on [REDIRECT_HANDLER] => x-mapp-php5.5 [REDIRECT_STATUS] => 200 [UNIQUE_ID] => Unique-ID [HTTPS] => on [HTTP_HOST] => domain-name [HTTP_ACCEPT] => application/vnd.ims.lis.v2.lineitemcontainer+json [PATH] => /bin:/usr/bin [SERVER_SIGNATURE] => [SERVER_SOFTWARE] => server [SERVER_NAME] => domain-name [SERVER_ADDR] => server [SERVER_PORT] => server [REMOTE_ADDR] => server [DOCUMENT_ROOT] => root/htdocs/moodle [REQUEST_SCHEME] => https [CONTEXT_PREFIX] => /system-bin/ [CONTEXT_DOCUMENT_ROOT] => root/lib/cgi-bin/ [SERVER_ADMIN] => webmaster@domain-name [SCRIPT_FILENAME] =>root/htdocs/moodle/mod/lti/services.php [REMOTE_PORT] => 28048 [REDIRECT_URL] => /mod/lti/services.php/3/lineitems [REDIRECT_QUERY_STRING] => type_id=4 [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => type_id=4 [REQUEST_URI] => /mod/lti/services.php/3/lineitems?type_id=4 [SCRIPT_NAME] => /mod/lti/services.php [PATH_INFO] => /3/lineitems [PATH_TRANSLATED] =>root/htdocs/moodle/mod/lti/services.php [STATUS] => 200 [PHP_SELF] => /3/lineitems [REQUEST_TIME_FLOAT] => 1673611804.6154 [REQUEST_TIME] => 1673611804 [argv] => Array ( [0] => type_id=4 ) [argc] => 1 ) [{"id":"https://domain-name/mod/lti/services.php/3/lineitems/107/lineitem?type_id=4","label":"test","scoreMaximum":100,"resourceId":"","tag":"","resourceLinkId":"11","ltiLinkId":"11"},{"id":"https://domain-name/mod/lti/services.php/3/lineitems/108/lineitem?type_id=4","label":"New column","scoreMaximum":75,"resourceId":"My resource","tag":"Essay"},{"id":"https://domain-name/mod/lti/services.php/3/lineitems/109/lineitem?type_id=4","label":"New column","scoreMaximum":75,"resourceId":"My resource","tag":"Essay"},{"id":"https://domain-name/mod/lti/services.php/3/lineitems/110/lineitem?type_id=4","label":"New column","scoreMaximum":75,"resourceId":"My resource","tag":"Essay"},{"id":"https://domain-name/mod/lti/services.php/3/lineitems/111/lineitem?type_id=4","label":"New column","scoreMaximum":75,"resourceId":"My resource","tag":"Essay"},{"id":"https://domain-name/mod/lti/services.php/3/lineitems/112/lineitem?type_id=4","label":"New column","scoreMaximum":75,"resourceId":"My resource","tag":"Essay"},{"id":"https://domain-name/mod/lti/services.php/3/lineitems/113/lineitem?type_id=4","label":"New column","scoreMaximum":75,"resourceId":"My resource","tag":"Essay"}] [responseHeaders] => HTTP/2 200 content-type: text/html; charset=utf-8 date: Fri, 13 Jan 2023 12:10:04 GMT server: server [relativeLinks] => Array ( ) [status] => 200 [error] => [url:ceLTIc\LTI\Http\HttpMessage:private] => https://domain-name/mod/lti/services.php/3/lineitems?type_id=4 [method:ceLTIc\LTI\Http\HttpMessage:private] => GET [responseJson] => ) This is the return i get from the getAll do while loop |
LineItems have been set with the context, I am getting duplicated lineItems being added also |
The only error I can see with this request is that the content-type of the response is given as "text/html" when it should be "application/vnd.ims.lis.v2.lineitemcontainer+json". I notice that the responseJson property is empty. Are you getting any error messages logged when the Service->send method tries to use json_decode on the response property? Is the response property being returned as valid JSON? It also looks like you might be passing a resource link ID value instead of the resource ID when calling the getLineItems method. |
thanks for the reply, I have worked through some of the suggestions you have made and have now got it working to how i want. Thank you for the advice and appreciate the time. |
Iam trying to retrieve lineitems - using the context.
My code is -
use ceLTIc\LTI;
require_once('lib.php');
$db = null;
init($db, true);
Debugging the httpMessage i can see 5 requests being made 3 GET 2 POST
Any advice on where im possibly getting stuck with retrieving the response to be use able.
The text was updated successfully, but these errors were encountered: