Nick Davies
Nick Davies

Reputation: 653

Microsoft Graph - POST request error 20132

I can't seem to get a POST request to create assignments using Microsoft Graph.

Both in the Graph Explorer and in PHP I get the same error: "message": "The content of the request is invalid. Common causes are an invalid Content-Type header or no content in the body.",

Endpoint: https://graph.microsoft.com/beta/education/classes/class-id/assignments

Request Headers: content-type: application/json

Body:

{
  "dueDateTime": "2014-02-01T00:00:00Z",
  "displayName": "Midterm 1",
    "instructions":  {
      "contentType": "Text",
      "content": "Read chapters 1 through 3"
    },
      "grading": {
        "@odata.type": "#microsoft.education.assignments.api.educationAssignmentPointsGradeType",
        "maxPoints": 100
      },
      "assignTo": {
        "@odata.type": "#microsoft.education.assignments.api.educationAssignmentClassRecipient"
      },
      "status":"draft",
      "allowStudentsToAddResourcesToSubmission": true
}

Any help would be truly appreciated!

Please see image of Graph Explorer below.

Microsoft Graph Example Request

Upvotes: 1

Views: 407

Answers (1)

Nick Davies
Nick Davies

Reputation: 653

Figured it out. Removing the "contentType": "Text" attribute from instructions worked.

Upvotes: 1

Related Questions