【发布时间】:2018-11-07 14:55:38
【问题描述】:
我似乎无法收到使用 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 图片。
【问题讨论】:
-
能否提供MS Graph Explore中请求的屏幕截图?
-
嗨@kikang 当然,请看上图。这是我尝试过的示例之一。在“请求标头”下,我设置了 Content-type: application/json。
-
想通了。从有效的说明中删除“contentType”:“Text”属性。
标签: php rest microsoft-graph-api microsoft-graph-sdks microsoft-graph-edu