我正在尝试连接到 API(在本例中为 freeagent)以获取一些数据。我使用 Googles OAuth Playground 为我生成了一个令牌。
var req = (HttpWebRequest)WebRequest.Create("https://api.freeagent.com/v2/recurring_invoices");
req.Headers["Authorization"] = "Bearer " + Convert.ToBase64String(Encoding.ASCII.GetBytes(_accessToken));
req.ContentType = "application/xml";
req.Accept = "application/xml";
req.Method = "GET";
// and get the response
var resp = req.GetResponse();
var streamIn = new StreamReader(resp.GetResponseStream());
returnData = streamIn.ReadToEnd();
streamIn.Close();
return resp;
现在我正在尝试转换以下内容:https ://dev.freeagent.com/docs/using_curl
我经常收到错误请求 HTTP 400 - 有人对可能导致此问题的原因有任何建议吗?