go-meraki
is a Go client library for Cisco Meraki. It is based on Nathan's excellent goaci module and features a simple, extensible API and advanced JSON manipulation.
To start using go-meraki
, install Go and go get
:
$ go get -u github.com/netascode/go-meraki
package main
import "github.com/netascode/go-meraki"
func main() {
client, _ := meraki.NewClient("abc123")
res, _ := client.Get("/organizations")
println(res.Get("0.name").String())
}
This will print something like:
My First Organization
meraki.Result
uses GJSON to simplify handling JSON results. See the GJSON documentation for more detail.
res, _ := client.Get("/organizations")
for _, obj := range res.Array() {
println(obj.Get("@pretty").String()) // pretty print network objects
}
meraki.Body
is a wrapper for SJSON. SJSON supports a path syntax simplifying JSON creation.
body := meraki.Body{}.
Set("name", "NewNetwork1").
Set("productTypes", []string{"switch"})
client.Post("/organizations/123456/networks", body.Str)
See the documentation for more details.