Skip to content

Guide · Open source

How to use Resty: a Go HTTP and REST client guide

Updated · written with AI from the project's own documentation and checked against our catalogue data

Resty is an open-source Go library for sending HTTP requests, calling REST APIs and receiving server-sent events (SSE) from your own Go code. It wraps Go's standard HTTP tools in a simpler interface. This guide is for Go developers and explains what you need, how to install the v3 module, and where to find the full documentation so you can start making requests.

Restygo-resty/resty · ★ 11.8k · MIT

Quick start

  1. 1Check your Go version. Confirm that you have Go 1.23 or newer installed, as the README requires.
  2. 2Open your Go project. Move to the directory of the Go module where you want to use Resty.
  3. 3Install the v3 module. Run go get resty.dev/v3 to add the library to your project.
  4. 4Import Resty in your code. Add the resty.dev/v3 import to the Go file that will send requests.
  5. 5Read the documentation. Open https://resty.dev for guides and the pkg.go.dev page for API details.
  6. 6Send a request. Use the Resty client to call your HTTP or REST API, or to receive server-sent events.

What Resty is and when to use it

Resty is a code library, not a standalone application. You import it into a Go program to send web requests to other services, such as a REST API, or to receive server-sent events. The project describes itself as a simple HTTP, REST and SSE client library for Go.

It is a good fit for Go developers who call HTTP APIs and want a simpler client than the standard library's HTTP calls, or for projects that need SSE on the client side.

  • Use it if: your project is written in Go and calls HTTP or REST APIs.
  • Use it if: you need server-sent events on the client side.
  • Skip it if: you are not a programmer, since it is a library rather than a ready-made app.
  • Skip it if: your project is not written in Go, since it only works with Go.

Check the requirements before you install

Resty needs Go 1.23 or newer. The README states that go1.23 and above is required, so if your project must target an older Go version, Resty is not an option for it.

Resty is MIT licensed, and its documentation and website are released under Apache-2.0.

Install the Resty v3 module

Resty is installed as a Go module with the standard Go tooling. The README gives the command to install the v3 module. Run it in your project directory, where your Go module is set up.

Resty v3 is served from the vanity URL resty.dev/v3, so the import path you use in your code is based on that address.

go get resty.dev/v3

Make your first request

Once the module is installed, import Resty in your Go code and use it to send requests to the service you want to call. For the exact client setup, request methods and SSE handling, follow the official documentation at https://resty.dev, which the README points to. It also refers to godoc for API details, available at pkg.go.dev/resty.dev/v3.

  • Import resty.dev/v3 in the Go file that makes the request.
  • Check the documentation at resty.dev for example usage of the client.
  • Use pkg.go.dev/resty.dev/v3 to look up the API for the functions you call.

Choose between Resty, net/http and other clients

Resty wraps Go's standard net/http package in a simpler interface. If you prefer to use only the standard library, net/http is the built-in option and needs no extra dependency. Other comparable projects include go-resty/resty v2 and carlmjohnson/requests.

The README notes that v2 migrated to github.com/go-resty/resty/v2. Pick the version that matches your project and check its documentation before you start.

  • net/http: Go's standard library, no third-party dependency.
  • go-resty/resty v2: the earlier major version, imported from github.com/go-resty/resty/v2.
  • carlmjohnson/requests: another HTTP client for Go.

Get help and contribute

Questions about usage are best directed to the documentation at resty.dev. The README invites feedback, real-world usage stories and discussion on GitHub Discussions. Contributions are welcome through pull requests, and the README says they must include test cases with patch coverage of 100%.

  • Read the docs at https://resty.dev.
  • Discuss usage on GitHub Discussions at github.com/go-resty/resty/discussions.
  • Send pull requests for fixes or improvements, with tests.

What people use it for

  • Calling a REST API from a Go backend service.
  • Receiving server-sent events from a server in a Go program.
  • Replacing verbose standard-library HTTP code with a simpler client in a Go project.
  • Building a Go command-line tool that fetches data from web services.

Frequently asked questions

Is Resty free to use?

Yes. Resty is released under the MIT licence, according to the README. Its documentation and website are released under Apache-2.0.

What do I need to install Resty?

You need Go 1.23 or newer. Install the v3 module with go get resty.dev/v3 from your Go project directory.

Does Resty work with languages other than Go?

No. Resty is a Go library and the source only supports Go projects.

Is Resty a standalone app?

No. It is a code library that you import into your own Go programs. It is not a ready-made application for non-programmers.

What is the difference between Resty and net/http?

Resty wraps Go's standard net/http tools in a simpler interface. net/http is built into Go and needs no extra dependency, while Resty adds a higher-level client.

Where can I find Resty documentation?

The README points to https://resty.dev for documentation and to godoc for API details. The pkg.go.dev page for resty.dev/v3 is also listed in the README badges.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Resty is a good choice for Go developers who call HTTP or REST APIs and want a simpler client, or who need server-sent events on the client side. If you are not writing Go, cannot use Go 1.23 or newer, or are happy with the standard library, use something else such as net/http.

Install options & downloads