我正在尝试向 Monday.com 写我的第一个请求,但无法弄清楚为什么我的请求返回“StatusCode:NotAcceptable”。我尝试了几种不同的方法来发送查询,但不确定这是问题所在。有没有人这样做过或以前见过这个问题?我改变了我的董事会我还尝试了获取和发布。谢谢你的帮助!
static async Task Main(string[] args)
{
//ReadXMLFileForSettings.ReadConfig();
var client = new RestClient("https://api.monday.com/v2/");
RestRequest request = new RestRequest() { Method = Method.Post };
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", $"{APIToken}");
request.AddParameter(new JsonParameter("query", "query { boards(ids: 1234) { owner{ id } columns { title type } } }"));
//request.AddParameter("query", "query { boards(ids: 1578294790) { owner{ id } columns { title type } } }");
//request.AddJsonBody(new
//{
// query = "query { boards(ids: 1578294790) { owner{ id } columns { title type } } }"
//});
var response = await client.ExecuteAsync(request);
var responseWorkloads = JObject.Parse(response.Content).SelectToken("boards");
var responseWorkloadsItems = responseWorkloads.SelectToken("items");
foreach (JObject value in responseWorkloadsItems)
{
foreach (var property in value.Properties())
{
Logging.WriteToLog(property.Name);
Logging.WriteToLog(property.Value.ToString());
}
}
}