Microsoft Graph-POST请求错误20132

时间:2018-11-07 14:55:38

标签: php rest microsoft-graph microsoft-graph-sdks microsoft-graph-edu

我似乎无法获得使用Microsoft Graph创建作业的POST请求。

在Graph Explorer和PHP中,我都遇到相同的错误:"message": "The content of the request is invalid. Common causes are an invalid Content-Type header or no content in the body.",

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

请求标头:content-type: application/json

身体:

{
  "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
}

任何帮助将不胜感激!

请在下面查看Graph Explorer的图像。

Microsoft Graph Example Request

1 个答案:

答案 0 :(得分:1)

弄清楚了。从有效的说明中删除"contentType": "Text"属性。