Skip to content

Instantly share code, notes, and snippets.

@drKnoxy
Created December 30, 2016 19:42
Show Gist options
  • Save drKnoxy/2296dd156d65ae80ffbb99a596f7dd1d to your computer and use it in GitHub Desktop.
Save drKnoxy/2296dd156d65ae80ffbb99a596f7dd1d to your computer and use it in GitHub Desktop.
package main
import (
"io"
"net/http"
"os"
)
const (
apiVersion = "v1"
baseURL = "https://api.unsplash.com"
// Headers: `Authorization: Client-ID YOUR_APPLICATION_ID`
// As query param: `https://api.unsplash.com/photos/?client_id=YOUR_APPLICATION_ID`
applicationID = "YOUR APPLICATION ID HERE"
)
func main() {
url := baseURL + "/search/photos/?query=hats&client_id=" + applicationID
resp, err := http.Get(url)
if err != nil {
println("error")
}
defer resp.Body.Close()
io.Copy(os.Stdout, resp.Body)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment