package main import ( "fmt" "io" "log" "net/http" "os" ) func main() { img_url := "https://dotmaui.com/favicon-32x32.png" endpoint := "https://api.dotmaui.com/client/1.1/imgresize/?apikey=%s&url=%s&width=64" url := fmt.Sprintf(endpoint, "YOUR_API_KEY", img_url) response, e := http.Get(url) if e != nil { log.Fatal(e) } defer response.Body.Close() file, err := os.Create("/tmp/my_img.png") if err != nil { log.Fatal(err) } defer file.Close() _, err = io.Copy(file, response.Body) if err != nil { log.Fatal(err) } fmt.Println("Success!") }