https://github.com/xlab/api
Package api is a helper that simplifies the process of REST APIs bindings creation in Go.
https://github.com/xlab/api
Last synced: 17 days ago
JSON representation
Package api is a helper that simplifies the process of REST APIs bindings creation in Go.
- Host: GitHub
- URL: https://github.com/xlab/api
- Owner: xlab
- License: mit
- Created: 2014-07-19T12:52:11.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-08-24T23:58:48.000Z (almost 12 years ago)
- Last Synced: 2025-03-23T01:24:47.943Z (over 1 year ago)
- Language: Go
- Size: 180 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
API
---
[](https://godoc.org/github.com/xlab/api)
#### Installation:
```
go get github.com/xlab/api
```
#### Use case:
```go
svc, _ := api.New("http://example.com")
args := url.Values{}
args.Set("filter", "1")
args.Set("price", "200")
req, _ := svc.Request(api.POST, "/categories/1", args)
// req.URL is now http://example.com/categories/1
// req.Body is now filter=1&price=200
// req.Header now has Content-Type: application/x-www-form-urlencoded
var cli http.Client
resp, err := cli.Do(req)
```
#### License
MIT