Skip to content

Instantly share code, notes, and snippets.

@carlqt
Created March 13, 2017 23:23
Show Gist options
  • Save carlqt/c86bcf7b48dd0d8f6fbe49f3062165b9 to your computer and use it in GitHub Desktop.
Save carlqt/c86bcf7b48dd0d8f6fbe49f3062165b9 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"io/ioutil"
"net/http"
"os"
)
func main() {
busKey := os.Getenv("ACCOUNT_KEY")
// googleServerKey := os.Getenv("GOOGLE_SERVER_KEY")
ltaUserKey := "3f8e685f-1505-4fe1-9b70-f08f8e8f3cbe"
url := "http://datamall2.mytransport.sg/ltaodataservice/BusStops?$skip=13"
client := &http.Client{}
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("UniqueUserID", ltaUserKey)
req.Header.Set("AccountKey", busKey)
req.Header.Set("Accept", "application/json")
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println("response Body:", string(body))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment