Graph进行API调用时请求400错误

Graph进行API调用时请求400错误

本文介绍了对Microsoft Graph进行API调用时请求400错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从Microsoft Graph API得到的错误是

The error I'm getting from Microsoft Graph API is this

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'."
}

我能够从端点 https://graph.microsoft .com/v1.0/me/contacts ,但使用POSTman时却去了scribe-java库OAuthRequest,我收到此错误.
我的请求将转到网址 https://graph.microsoft.com/v1.0 /me/contacts (带有2个标题).授权->承载[令牌]
内容类型-> application/json

I'm able to successfully get from the endpoint https://graph.microsoft.com/v1.0/me/contacts while using POSTman however going the the scribe-java library OAuthRequest I receive this error.
My request is going to the url https://graph.microsoft.com/v1.0/me/contacts with 2 headers.Authorization -> Bearer [Token]
Content-Type -> application/json

推荐答案

事实证明scribe-java库未正确设置请求.切换到apache HttpClient和HttpGet为我解决了这个问题.

It turns out the scribe-java library doesn't setup the request correctly. Switching to apache HttpClient and HttpGet resolved the issue for me.

这篇关于对Microsoft Graph进行API调用时请求400错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-03 23:59