Created
December 30, 2016 19:42
-
-
Save drKnoxy/2296dd156d65ae80ffbb99a596f7dd1d to your computer and use it in GitHub Desktop.
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
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