.Net Core and GraphQL running query

.Net Core and GraphQL running query


0

This graphQL query runs in Postman, but is not returning data in my program. Any ideas?

        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("");

        }

Did what I could to find relevant posts but not finding anything. I am new to this so it is probably something simple.


Load 7 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *