REST API for SaaS in Golang and API Documentation

The example web-api service in the SaaS Startup Kit includes API documentation. The API documentation is autogenerated using Swagger with Swag GO. The Swag Go project also provides a web UI to allow you and your customers of your SaaS to explore your API - its exposed business logic - as well as easily try our that exposed functionality.

Refer to an example of the API documentation for the example project here:
api.example.saasstartupkit.com/docs/

Go Swagger UI for API Documentation

Go Swagger API documentation for SaaS

The example web API implemented Swagger to automatically create API documentation and provide a UI to explore the API and its documentation.

SaaS API endpoint documentation with Go Swagger

The Swagger UI for the API documentation provides details on the API endpoints and associated data models. The documentation for the API endpoints include its URI, the HTTP method and expected/optional parameters.

View API Endpoints

SaaS API endpoint with Go Swag

The Swagger API allows you to view details on each API endpoint. This includes the expected/optional parameters along with examples responses. Once you are authenticated with the web-api service using the Swagger UI, you can even try an API out.

Authorize with SaaS web-api service

Go Swag oAuth authentication with SaaS REST API

The Swagger UI for API documentation provides functionality that allows you to authenticate with the web-api service using oAuth2. You will authenticate with the API using your email and password in order to receive an oAuth token.

Go Swag oAuth credentials with SaaS REST API

Once authenticated with the web-api service using the Swagger UI, you will receive your oAuth authorization token that Swagger refers to as the client secret. The Swagger UI will then save this auth token so you can use the UI to try out other API endpoints that require authentication.

Try Golang API Endpoints

Example REST API using GO Swagger

When you are authenticated with the web-api service you can try out a specific API endpoint by clicking the Try It Out button. Then you will need to specify values for any required parameters and optional parameters.

Testing REST API endpoint using GO Swagger

To see the results of your example API request, click the Execute button. The Swagger UI will make the request to the web-api service and return the results for you. This is helpful for exploring the data available and building implementation plans.

View Data Models

Example Data Models API documentation using Go Swag

The Swagger UI for the example web-api service also provides the ability to view the data models. You can browse all the available and documented data models for the exposed endpoints.

Example API documentation for Data Model using Go Swag

You can view a specific data model to see the key and its associated type. For fields that are enums, it includes the possible values.

Provide Feedback via our Google Slides

If you would like to provide us feedback on any of these screen captures and associated functionality, you are welcome to publicly comment on our Google Slides:

Open in Google Slides