Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Modern REST API Development in Go
Modern REST API Development in Go

Modern REST API Development in Go: Design performant, secure, and observable web APIs using Go's powerful standard library

Arrow left icon
Profile Icon Jesús Espino
Arrow right icon
$31.99 $35.99
eBook Aug 2025 294 pages 1st Edition
eBook
$31.99 $35.99
Paperback
$44.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Jesús Espino
Arrow right icon
$31.99 $35.99
eBook Aug 2025 294 pages 1st Edition
eBook
$31.99 $35.99
Paperback
$44.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$31.99 $35.99
Paperback
$44.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Modern REST API Development in Go

Exploring REST APIs

A REST API can be simple or complicated, have thousands of different resources with millions of entities, or expose only one resource with a few entities. Every developer can decide how to use query parameters, HTTP headers, and HTTP verbs. Nothing is written in stone here because REST provides the guiding principles, but the developer always makes the final decision.

For this reason, it’s essential to have the right tools and resources to understand an API properly before consuming it, as well as the right tools to explore and investigate how to use that API in real life.

This chapter will explore three tools I consider the bread and butter of any API user:

  • OpenAPI: The OpenAPI documentation defines our REST API, declaring the resources, entities, and operations we can perform on each resource, as well as the authentication mechanism; everything is exposed in OpenAPI.
  • Postman: Postman is one of the most popular applications for...

Technical requirements

We won’t be writing any code in this chapter; instead, we’ll explore an API using the methods mentioned previously. To do so, we’ll need to have Postman and curl installed. We’ll also need to create a free account in Postman so that we can use the application to its fullest potential.

OpenAPI

OpenAPI is a standard from the OpenAPI Initiative that describes HTTP APIs and is the de facto standard for REST APIs.

It imparts a detailed description of all the URLs, methods, parameters, resources, entities, and serialization mechanisms available while also providing examples of how to use the API in code.

In this section, we’ll explore the basic shape of OpenAPI and the main things you need to look at to understand an API. However, we won’t get into the details of the OpenAPI format. Instead, I’ll help you understand an API through its OpenAPI documentation.

We’ll explore how to document APIs using OpenAPI in Chapter 11.

For now, let’s talk more about the OpenAPI file and its format.

The OpenAPI file

The OpenAPI file is a YAML Ain’t Markup Language (YAML) file containing general API information and a list of paths. Each path represents a URL in your API; you can have a set of accepted methods for that URL...

Postman

Postman is an HTTP client specially designed to consume APIs. It’s the de facto standard in the industry to explore and try APIs with a graphical interface. It’s compatible with OpenAPI and allows us to explore APIs but also interact with them directly there.

In this section, we’re going to explore the basic usage of Postman and give you a sneak peek at its potential. We’ll start by importing an API definition, studying it, and interacting with it by sending a request.

So, let’s start by installing the tool and importing an API.

Importing an API

You can download and install Postman locally from https://www.postman.com/downloads/ or directly from their web page at https://web.postman.co. It works perfectly fine in both cases, but you should consider using the installable application for local development.

One of the fantastic things about Postman is that it comes with many already existing APIs that are easy to incorporate...

curl

curl is the Swiss Army knife of REST API testing. It can build any request you need with the headers and parameters you want, all in a compact and easy-to-use CLI. If you don’t have it installed on your system, you can use your system package manager or follow the instructions at https://curl.se/.

If you’re like me and prefer to interact with the command line, you’ll love curl (and you probably already know it). Not only that, but curl is used everywhere and is supported by a lot of applications, so it isn’t rare to have curl command-line examples in API documentation that provide support for extracting curl calls from places such as the Web Developers Tools of Firefox and Chrome in the Network tab, allowing you to reproduce network calls in your command line by copy and pasting.

In this section, we’ll explore using the curl command to send requests and get information such as headers in the response.

Getting information

The...

Summary

In this chapter, we explored different ways to understand APIs better. First, we looked at using OpenAPI to get information on what we can do and how to use an API. We can explore APIs in read-only and “map” fashion using the YAML format or the OpenAPI-generated documentation pages. We saw how powerful and valuable this can be by looking at some examples and details about various parameters and methods.

Then, we considered another option – not only for exploring but also for interacting with APIs quickly and powerfully: Postman. We learned how to explore and interact with well-known public APIs or build our own and test them through the Postman interface.

Finally, we explored curl, a great CLI tool that provides us with everything we need to interact with our APIs from the command line and helps us with testing and debugging.

But this has nothing to do with Go, which is what this book is about. So, let’s jump into the next chapter and...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Build scalable APIs using Go’s robust standard library and HTTP tooling
  • Explore security, observability, and testing from a backend engineering perspective
  • Learn foundational REST principles by building a complete Go-based project

Description

Modern REST API Development in Go is a hands-on guide to understanding and applying REST principles using Go’s powerful standard library. In an era where interconnected systems demand robust and performant APIs, Go offers the perfect combination of simplicity, performance, and tooling to build modern backend services. This book is centered around a complete, real-world REST API project and guides you through every stage of the development process, from building HTTP handlers to applying authentication and generating OpenAPI documentation. You’ll learn to structure your application, handle persistence with common libraries like GORM and Squirrel, apply observability patterns through logging and tracing, and ensure code quality through unit and integration tests. Each concept is grounded in REST theory and backed by idiomatic Go practices, enabling you to build APIs that are not only functional but production-ready. By the end of the book, you’ll be ready to design, build, and maintain REST APIs in Go.

Who is this book for?

This book is for developers who want to begin building REST APIs using the Go language. Whether you’re new to Go or experienced in backend development, you’ll gain practical skills and foundational knowledge to build secure, performant, and maintainable APIs. Ideal for backend engineers, system integrators, and full-stack developers entering the Go ecosystem.

What you will learn

  • Understand and implement HTTP handlers in Go
  • Create and manage RESTful routes
  • Persist and model data using GORM and Squirrel
  • Secure APIs with JWTs and basic authentication
  • Validate incoming requests with custom logic
  • Log and trace API activity for observability
  • Write unit and integration tests for endpoints
  • Generate API documentation using OpenAPI

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Aug 20, 2025
Length: 294 pages
Edition : 1st
Language : English
ISBN-13 : 9781836205364
Languages :
Concepts :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Aug 20, 2025
Length: 294 pages
Edition : 1st
Language : English
ISBN-13 : 9781836205364
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Table of Contents

17 Chapters
Introduction to APIs Chevron down icon Chevron up icon
Exploring REST APIs Chevron down icon Chevron up icon
Building a REST Client Chevron down icon Chevron up icon
Designing Your REST API Chevron down icon Chevron up icon
Authentication and Authorization Chevron down icon Chevron up icon
Data Persistency Chevron down icon Chevron up icon
API Security Chevron down icon Chevron up icon
API Performance Chevron down icon Chevron up icon
Deploying Your API Chevron down icon Chevron up icon
Testing Chevron down icon Chevron up icon
Documenting with OpenAPI Chevron down icon Chevron up icon
Metrics, Logs, and Traces Chevron down icon Chevron up icon
Using GORM Chevron down icon Chevron up icon
Using the Echo Framework Chevron down icon Chevron up icon
Unlock Your Book’s Exclusive Benefits Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.

Modal Close icon
Modal Close icon