提问人:BumpaRoy 提问时间:9/20/2023 更新时间:9/20/2023 访问量:37
.Net Core 和 GraphQL 运行查询
.Net Core and GraphQL running query
问:
此 graphQL 查询在 Postman 中运行,但未在我的程序中返回数据。有什么想法吗?
public static async Task RunAsync()
{
// Update port # in the following line.
client.BaseAddress = new Uri(ServerUrl);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
// GET: Get data from Server
var productRequest = new GraphQLRequest
{ Query = @"{
products
{
items {
fpartno
frev
fdescript
}
}
}" };
//var productRequest = new GraphQLRequest
//{ Query = @"{ products(filter:{fpartno: {contains: ""WF""}}) { items { fpartno frev fdescript } }" };
var graphQLClient = new GraphQLHttpClient(ServerUrl, new NewtonsoftJsonSerializer());
var graphQLResponse = await graphQLClient.SendQueryAsync<Rootobject>(productRequest);
Debug.Print("");
}
尽我所能找到相关帖子,但没有找到任何东西。我是新手,所以它可能很简单。
答: 暂无答案
评论