Created
September 16, 2021 03:16
-
-
Save kgravenreuth/eef383a80983e77e77464bee2ef62b3b to your computer and use it in GitHub Desktop.
Cloudbet API Bet History in Go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
client := &http.Client{} | |
req, err := http.NewRequest("GET", "https://sports-api.cloudbet.com/pub/v3/bets/history?limit=5&offset=0", nil) | |
if err != nil { | |
log.Fatal(err) | |
} | |
req.Header.Set("accept", "application/json") | |
req.Header.Set("X-API-Key", "eyJ...") // <-- use your API key | |
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) // {"bets":[{"referenceId":"1891d3a0-0af8-11ec-b536-11ca86b8c5a4","price":"1.652","eventId":"7190563","marketUrl":"soccer.asian_handicap/home? handicap=0.5","side":"BACK","currency":"PLAY_EUR","stake":"1.1","status":"ACCEPTED", "returnAmount":"0","eventName":"Sevilla FC V FC Salzburg", "sportsKey":"soccer","competitionId":"85","categoryKey":"international_clubs","error":""},{"referenceId":"300f1f90-a182-11eb-ae26-db06bcd7e230", "price":"1.377","eventId":"5943646","marketUrl":"soccer.match_odds/home","side": "BACK","currency":"PLAY_EUR","stake":"1","status":"LOSS","returnAmount":"-1","eventName":"UE Santa Coloma A V CE Carroi","sportsKey":"soccer","competitionId":"488","categoryKey":"andorra","error":""}],"totalBets":"2"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment