cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
carols
Community Member

Assignments API external_tool_tag_attributes - can you pass arbitrary custom variables

We're working with assignments that are being submitted to Turnitin via an LTI external tool

We want to be able to update the data within an individual Turnitin assignment from API calls.

I can see that in the assignments API, there is the possibility of passing data into an external tool via the ExternalToolTagAttributes object:

Assignments - Canvas LMS REST API Documentation 

The documentation states:

// (Optional) assignment's settings for external tools if submission_types include  // 'external_tool'. Only url and new_tab are included (new_tab defaults to false).   // Use the 'External Tools' API if you need more information about an external  // tool.

Bearing in mind that the External Tools API allows a range of around 20 custom parameters to be passed into Turnitin, I was hoping that this was an indication that we could use this external_tool_tag_attributes object to pass in arbitrary custom parameters into an individual assignment within Turnitin

In particular, I'm trying to set custom_feedbackreleasedate.

However, I have not yet found a way of doing this. This is one of the calls I have attempted (I'm using the tool postman to handle the API calls)

PUT https://oursitehere:443/api/v1/courses/:course/assignments/:assignment?assignment[external_tool_tag_...

assignment[description]=Assignment-test-attempt-99&

assignment[external_tool_tag_attributes[custom_feedbackreleasedate]]=2018-08-01T10:00:00Z

When I run this with appropriate authentication and correct id values, my attempt to toggle the new_tab field and to set the assignment description succeed

However, I'm not able to set the release date.

Is there a way of passing key-value pairs through to an individual assignment via this object?

If not, is there another way of setting values in individual Turnitin assignments?

We are migrating from Moodle, where we were able to handle this via the LTI tool to automate our assessment process, so it does seem as though it could be feasible.

Labels (1)
Tags (2)
2 Replies
maguire
Community Champion

Have you looked at the secure_params element of an assignment?

canvas-lms/external_tools_controller.rb at master · instructure/canvas-lms · GitHub  seems to show these being decoded and then passed as parameters in the LTI call. JWT standards for JSON Web Tokens - see JSON Web Token Introduction - jwt.io 

One needs the appropriate 256-bit secret to compute the HMAC (in the case when the algorithm is "HS256").

0 Kudos
maguire
Community Champion

You can pass custom fields to the LTI tool. See for example the output of a GET for the following:

http://www.canvas.docker:80/api/v1/courses/2/external_tools/2

{   "id": 2,   "domain": null,   "url": "https://localhost:3597/announce",   "consumer_key": "test",   "name": "ChipIT",   "description": "A test for being able to automate degree project presentation announcements.",   "created_at": "2019-06-01T11:01:19Z",   "updated_at": "2019-07-06T13:28:50Z",   "privacy_level": "anonymous",   "custom_fields": {     "sis_id": "$Canvas.user.sisSourceId",     "user_sis_id": "$Person.sourcedId",     "context_source_id": "$Context.sourcedId",     "context_title": "$Context.title",     "context_id": "$Context.id",     "message_documenttarget": "$Message.documentTarget",     "module_id": "$Canvas.module.id",     "module_id_item": "$Canvas.moduleItem.id",     "chip_canvas_module_id": "$Canvas.module.id",     "chip_canvas_module_item_id": "$Canvas.moduleItem.id",     "chip2_canvas_module_id": "${Canvas.module.id}",     "chip2_canvas_module_item_id": "${Canvas.moduleItem.id}",     "chip3_com_instructure_context_label": "$com.instructure.contextLabel",     "coursecode": "$Canvas.course.id",     "userid": "$Canvas.user.sisSourceId"   },   "workflow_state": "anonymous",   "vendor_help_link": null,   "account_navigation": null,   "similarity_detection": null,   "assignment_edit": null,   "assignment_menu": null,   "assignment_selection": null,   "assignment_view": null,   "collaboration": null,   "course_assignments_menu": null,   "course_home_sub_navigation": null,   "course_navigation": {     "default": "enabled",     "display_type": "full_width_in_context",     "enabled": "true",     "text": "ChipIt",     "windowTarget": "_self",     "url": "https://localhost:3597/announce",     "visibility": "admins",     "label": "ChipIt",     "selection_width": 800,     "selection_height": 400   },   "course_settings_sub_navigation": null,   "discussion_topic_menu": null,   "editor_button": null,   "file_menu": null,   "global_navigation": null,   "homework_submission": null,   "link_selection": null,   "migration_selection": null,   "module_menu": null,   "post_grades": null,   "quiz_menu": null,   "resource_selection": null,   "student_context_card": null,   "tool_configuration": null,   "user_navigation": null,   "wiki_page_menu": null,   "not_selectable": false,   "version": "1.1" }

It passes the custom fields to the external LTI tool.
Chip

0 Kudos