Go

ThingsOn HTTP API / Go

Go programlama dilini kullanarak platformdan veri sorgulamak için aşağıdaki örneği kullanabilirsiniz.

Read
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "http://cloud.thingson.io:8086/query?db=[DB_NAME]&q=[QUERY]"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic [API_KEY]")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}