Member-only story

GO

Calling GraphQL API in Go

using standard http library.

Donald Le

--

A graphql query convert to json will be like this:

{"query":"query ($filter: JSON) {       subject (accessibility: all, offset: 0, first: 20, filter: $filter) {          submitter_id variant_count gene_count gender ethnicity age bmi is_tobacco_smoking cigarettes_per_day is_alcohol_drinking type_of_alcohol_used beer_drinks_per_week alcohol_drinks_per_week original_area sample_collection_area total_files       }     }",{"variables":{"filter":{"AND":[{"IN":{"bmi_range":["normal"]}}]}}}

We can see the converted json by browser developer tool:

Then we can easily use http library in Go:

Hope it helps!!

PEACE!

--

--

No responses yet