Web Clients and APIs

Working with APIs and writing web clients can be a tricky business. Different APIs have different types of authorization, authentication, and protocol. We'll explore the http.Client structure object, work with OAuth2 clients and long-term token storage, and finish off with GRPC and an additional REST interface.

By the end of this chapter, you should have an idea of how to interface with third-party or in-house APIs and have some patterns for common operations, such as async requests to APIs.

In this chapter, we will cover the following recipes:

  • Initializing, storing, and passing http.Client structures
  • Writing a client for a REST API
  • Executing parallel and async client requests
  • Making use of OAuth2 clients
  • Implementing ...

Get Go Programming Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.