Example calls a custom REST API, "/_cat/example".
()
| 53 | |
| 54 | // Example calls a custom REST API, "/_cat/example". |
| 55 | func (c *ExtendedAPI) Example() (*esapi.Response, error) { |
| 56 | req, _ := http.NewRequest("GET", "/_cat/example", nil) // errcheck exclude |
| 57 | |
| 58 | res, err := c.Perform(req) |
| 59 | if err != nil { |
| 60 | return nil, err |
| 61 | } |
| 62 | |
| 63 | return &esapi.Response{StatusCode: res.StatusCode, Body: res.Body, Header: res.Header}, nil |
| 64 | } |
| 65 | |
| 66 | func main() { |
| 67 | log.SetFlags(0) |