我从Microsoft Graph API获得的错误就是这个
error = {
"code": "BadRequest",
"innerError": {
"date": "2017-04-10T19:37:08",
"request-id": "973641dd-b150-4406-9f3b-fbcf6f7e5aa1"
},
"message": "The MIME type 'text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2' requires a '/' character between type and subtype, such as 'text/plain'."
}
我可以使用POSTman成功从 endpoints https://graph.microsoft.com/v1.0/me/contacts获取,但是去了scribe-java库OAuthRequest我收到此错误 .
我的请求是带有2个 Headers 的url https://graph.microsoft.com/v1.0/me/contacts . 授权 - >承载[令牌]
Content-Type - > application / json
2 回答
事实证明,scribe-java库没有正确设置请求 . 切换到apache HttpClient和HttpGet为我解决了这个问题 .
尝试在请求中明确设置"Accept"标头 . POSTman可能会默认你[Accept = text / html,image / gif,image / jpeg,*; q = .2,/; Q = 0.2]