如何解决RestAPI使用Microsoftgraph进行威胁评估请求的问题
我正在尝试与https://graph.microsoft.com/v1.0/informationProtection/threatAssessmentRequests
建立联系得到以下错误: 401 {
“错误”:{
"code": "Unauthorized","message": "Required authentication information is either missing or not valid for the resource.","innerError": {
"date": "2020-11-06T15:21:22","request-id": "8f4d480e-2916-4501-904b-0ca13db9e85e","client-request-id": "8f4d480e-2916-4501-904b-0ca13db9e85e"
我正在使用python3.7,代码如下:
token ="xyz.dslkdskds_123"
headers = {
"Content-type": "application/json","Authorization": "Bearer " + token
}
query1={
"@odata.type": "#microsoft.graph.urlAssessmentRequest","url": "info.cvx.com","contentType":"url","expectedAssessment": "block","category": "phishing"
}
url="https://graph.microsoft.com/v1.0/informationProtection/threatAssessmentRequests"
r = requests.post(url,headers=headers,data=json.dumps(query1))
解决方法
我在图浏览器中运行以下查询而没有必需的权限时遇到相同的问题
GET https://graph.microsoft.com/v1.0/informationProtection/threatAssessmentRequests
"error": {
"code": "Unauthorized","message": "Required authentication information is either missing or not valid for the resource."
但是在提供了必要的权限ThreatAssessment.ReadWrite.All
之后才能获取数据
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。