Community

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

How to create a TurnItIn assignment using the "plagiarism framework" via the canvas API

Previously I have created TurnItIn assignments on canvas using the canvas API with (python) code like:

import requests
access_token =' .... '
assignment={'assignment': {
     'description': 'A really wonderful test assignment',
     'due_at': '2020-02-23T12:59:59Z',
     'grading_type': 'points',
     'name': 'Another test Assignment',
     'points_possible': 32.0,
     'submission_types': ['external_tool'],
     'external_tool_tag_attributes': {'url': 'https://api.turnitin.com/api/lti/1p0/assignment'},
    }
}
headers = {'Accept': 'application/json',
 'Authorization': 'Bearer ' + access_token,
 'Cache-control': 'no-cache',
 'Content-Type': 'application/json; charset=UTF-8'}
}
requests.post(url='https://canvas....u/api/v1/courses/./.../assignments',
                headers=headers, json=assignment)

This worked fine but this interface is being phased out and I need to start using the plagiarism framework. Specifically, I want the assignments created through the API to have these settings:

canvas screens

Using the code above but with

assignment={'assignment': {
     'description': 'A really wonderful test assignment',
     'due_at': '2020-02-23T12:59:59Z',
     'grading_type': 'points',
     'name': 'Another test Assignment',
     'points_possible': 32.0,
     'submission_types': ['online_upload'],
    }
}

I get close to what I want except that when I go into canvas and edit the assignment created this way the "Select to use TurnItIn" menu is set to "None". So I have not enabled TurnItIn, which is not surprising since the json above does not mention it. The canvas documentation seems to suggest that setting

assignment['assignment]['turnitin_enabled] = true

might solve my problem but this does not help.

I have tried many variations on the code above, combed through the canvas API documentation and searched on the net but I can't find anything does what I want. Previously I was able to troubleshoot assignments by looking at the output from an API call

GET /api/v1/courses/:course_id/assignments/:id

but, surprisingly, there is no change in the returned json for the assignment before and after TurnItIn is manually added to the assignment, so I can't see what to change in my API call to create the assignment.

Is anyone able to suggest what I should do?

5 Replies
kona
Community Coach
Community Coach

 @andrew_mathas , greetings! I'm not sure of the answer to this question, but I'm sharing it with the Canvas Developers‌ group in the Community to see if they can help!

Kona

andrew_mathas
Community Member

It seems that this is a known issue: https://community.canvaslms.com/ideas/14664-add-api-end-points-for-plagiarism-framework 

The problem is that the canvas API is not providing the required endpoints to create assignments using the TurnItIn plagiarism framework.

Hi, any update on this issue? It looks like canvas API has the necessary key "turnitin_settings" in the assignment creation. I also don't have "sufficient privileges" to access the link you provided...

Thank you

As far as I can see this is still broken. The link that I posted abopve used to work but now I cannot access it either. It looks like infrastructure may have blocked access to the page...

Hi @andrew_mathas ...

The link you had provided in your earlier post pointed to the old Canvas Community website.  Back in August 2020, Instructure transitioned to a new Community platform.  Unfortunately, some links don't re-direct to display the new link.  Unfortunately, the link you are referring to is one of those links that didn't re-direct...which is why you and I are seeing that error message.  Normally, you'd be able to type in a few words from the old URL (which typically displays the title of the old posting) into the search field at the top of any page here in the Community site, and you'd be able to find the page/current URL for that topic.  But, in my own searching, I'm not able to find that page you are inquiring about.  I don't think it's necessarily that Instructure (not Infrastructure) blocked access to the page, though.  It seems like the link was to a Feature Idea in the Community, but I'm just not sure where it would have gone to...as they typically do not delete content from us as users.

Sorry I don't have better news for you at this time.