Skip to content

Latest commit

 

History

History
61 lines (39 loc) · 1.56 KB

README.md

File metadata and controls

61 lines (39 loc) · 1.56 KB

Tests

go-meraki

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.

Getting Started

Installing

To start using go-meraki, install Go and go get:

$ go get -u github.com/netascode/go-meraki

Basic Usage

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

Result manipulation

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
}

POST data creation

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)

Documentation

See the documentation for more details.