REST API - Creating rubric gives 200 OK status but does not create rubric

Jump to solution
Community Member

I am currently trying to write some Python scripts to automate creating rubrics for my courses. At the moment I'm testing against a test course I have. I'm able to successfully do some GET requests in Python, but my POST request to create a rubric isn't working. Documentation: ""

Step A: I have "Investigate" open in Firefox and I am looking at Network traffic as I create a rubric through the Canvas webpage itself. I get a 200 OK status, and the response gives me a rubric object with a valid ID. I am taking note of the request it sends. (Tried to attach an image but it seems to be failing.) The webpage request is basically the same as the first request I list in Step B.


Step B: I've been trying to create an object in Python and then using it as part of my post request. I have the following as the request object, which I'm using the request from the web example:

request_obj = {
"rubric[title]": "BBB",
"rubric[points_possible]": "5",
"rubric_association[use_for_grading]": "0",
"rubric_association[hide_score_total]": "0",
"rubric_association[hide_points]": "0",
"rubric_association[hide_outcome_results]": "0",
"rubric[free_form_criterion_comments]": "0",
"rubric_association[id]": "",
"rubric_association_id": "",
"rubric[criteria][0][description]": "Description+of+criterion",
"rubric[criteria][0][points]": "5",
"rubric[criteria][0][learning_outcome_id]": "",
"rubric[criteria][0][long_description]": "",
"rubric[criteria][0][id]": "",
"rubric[criteria][0][criterion_use_range]": "false",
"rubric[criteria][0][ratings][0][description]": "Full+Marks",
"rubric[criteria][0][ratings][0][long_description]": "",
"rubric[criteria][0][ratings][0][points]": "5",
"rubric[criteria][0][ratings][0][id]": "blank",
"rubric[criteria][0][ratings][1][description]": "No+Marks",
"rubric[criteria][0][ratings][1][long_description]": "",
"rubric[criteria][0][ratings][1][points]": "0",
"rubric[criteria][0][ratings][1][id]": "blank_2",
"title": "AAA",
"points_possible": "5",
"rubric_id": "new",
"rubric_association[association_type]": "Course",
"rubric_association[association_id]": "65930",
"rubric_association[purpose]": "bookmark",
"skip_updating_points_possible": "false",
"_method": "POST",
"authenticity_token": "[REDACTED]"

I've also tried this as a request object:

request_obj = { 
  "title":"API Rubric",
    "title":"API Rubric",
        "description":"Criteria 1",
            "description":"c1r1 description",
            "long_description":"c1r1 longdesc",
            "description":"c1r2 description",
            "long_description":"c1r2 longdesc",


And I am making the request like this:

uri = domain + "/api/v1/courses/" + course_id + "/rubrics"
header = { "Authorization" : "Bearer " + access_token }
response =
json=json.dumps( request_obj )


The result is a 200 OK, but the response on the webpage gives me an "id" and other items in its return json. When I make the request from Python, I get a null id and other fields:

Response: <Response [200]>
content: b'{"rubric":{"id":null,"user_id":15072,"rubric_id":null,"context_id":65930,"context_type":"Course","data":null,"points_possible":null,"title":null,"description":null,"created_at":null,"updated_at":null,"reusable":false,"public":false,"read_only":false,"association_count":0,"free_form_criterion_comments":null,"context_code":null,"migration_id":null,"hide_score_total":null,"workflow_state":"active","root_account_id":null,"criteria":null,"permissions":{"read":true,"create":true,"delete_associations":true,"update":true,"delete":true}}}'


I don't know if I'm maybe missing some information for the header, or the authenticity_token is different from my access_token and where I would even get the former. GET requests work, I was able to make a "duplicate assignment" request, but I'm stuck on this rubric creation and I'm not seeing an obvious issue.


It also doesn't help that Canvas doesn't create the rubric, but returns a "200 OK" instead of an error code with an error message.


Any ideas?


Labels (2)
1 Solution
Community Coach
Community Coach

Hi @rsingh13,

I haven't done much with rubrics via the API, but I've done some other calls...  Your second method (using JSON) is what I've done successfully with other Canvas APIs.  The one thing that stands out to me is that you're using json.dumps, which I have not had to do with my calls.  Maybe try that method with just json=request_obj to see if it works.


View solution in original post