Skip to content

Instantly share code, notes, and snippets.

@johnvilsack
Created June 25, 2014 14:24
Show Gist options
  • Save johnvilsack/8a0653448d4877ffa7e0 to your computer and use it in GitHub Desktop.
Save johnvilsack/8a0653448d4877ffa7e0 to your computer and use it in GitHub Desktop.
Sample of getting JSON (dumping errors so don't use)
func apiGetItem(q string) *queryItem {
requestURL := "http://epoch.app/inventory/apiGetItemInfo.php?q=" + q
getQuery, _ := http.Get(requestURL)
defer getQuery.Body.Close()
resultQuery, _ := ioutil.ReadAll(getQuery.Body)
payload := &queryItem{}
ok := json.Unmarshal(resultQuery, payload)
return payload
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment