I want to consume a GraphQL web API in .NET -
i want consume data graphql api. how can achieve that? new webapi , appreciated
assuming api want consume uses http, should able use curl, wget, charles, postman or url bar in browser make request.
to write first query, can start following:
query thenameofmyquery { }
now have named query, can start populating whatever fields graphql server exposing. blog example, might have this:
query thenameofmyquery { posts { title author } }
now, turn can request, need url encode , add url. typical url looks this:
https://www.someserver.com/?query=...&variables=...
so above example, have above query
https://www.someserver.com/?query=query%20thenameofmyquery%20%7b%0d%0a%20%20posts%20%7b%0d%0a%20%20%20%20title%0d%0a%20%20%20%20author%0d%0a%20%20%7d%0d%0a%7d
some resources:
- evolution of api design - video explains of concepts of graphql , why exists.
- howtographql.com - amazing set of tutorials every implementation imagine
Comments
Post a Comment