Skip to content

Instantly share code, notes, and snippets.

@kgravenreuth
Created September 16, 2021 03:11
Show Gist options
  • Save kgravenreuth/e757a4506c242041ad71102cb5759da9 to your computer and use it in GitHub Desktop.
Save kgravenreuth/e757a4506c242041ad71102cb5759da9 to your computer and use it in GitHub Desktop.
Cloudbet API Balance for your currency in Go
client := &http.Client{}
req, err := http.NewRequest("GET", "https://sports-api.cloudbet.com/pub/v1/account/currencies/PLAY_EUR/balance", nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("accept", "application/json")
req.Header.Set("X-API-Key", "eyJ...") // <-- use your API key
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
bodyText, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", bodyText) // {"amount":"984.69"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment