README.md
1consul-api
2==========
3
4*DEPRECATED* Please use [consul api package](https://github.com/hashicorp/consul/tree/master/api) instead.
5Godocs for that package [are here](http://godoc.org/github.com/hashicorp/consul/api).
6
7This package provides the `consulapi` package which attempts to
8provide programmatic access to the full Consul API.
9
10Currently, all of the Consul APIs included in version 0.4 are supported.
11
12Documentation
13=============
14
15The full documentation is available on [Godoc](http://godoc.org/github.com/armon/consul-api)
16
17Usage
18=====
19
20Below is an example of using the Consul client:
21
22```go
23// Get a new client, with KV endpoints
24client, _ := consulapi.NewClient(consulapi.DefaultConfig())
25kv := client.KV()
26
27// PUT a new KV pair
28p := &consulapi.KVPair{Key: "foo", Value: []byte("test")}
29_, err := kv.Put(p, nil)
30if err != nil {
31 panic(err)
32}
33
34// Lookup the pair
35pair, _, err := kv.Get("foo", nil)
36if err != nil {
37 panic(err)
38}
39fmt.Printf("KV: %v", pair)
40
41```
42
43