Use of HTTP API in influx db

How to make http api working in influx db?
Now able to make the GO installation working.

But how can we make the database creation in INFLUXDB using the command:

curl -G http://localhost:8086/query --data-urlencode “q=CREATE DATABASE mydb”

After this is the Go Forum I guess that you are writing a program in Go, which should access a influx db. Am I right?

So you should use the official Go client.

Here is the example from the documentation:

// Make client
c, err := client.NewHTTPClient(client.HTTPConfig{
    Addr: "http://localhost:8086",
})
if err != nil {
    fmt.Println("Error creating InfluxDB Client: ", err.Error())
}
defer c.Close()

q := client.NewQuery("CREATE DATABASE telegraf", "", "")
if response, err := c.Query(q); err == nil && response.Error() == nil {
    fmt.Println(response.Results)
}

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.