Redocly is a popular developer documentation platform with support for a developer portal and API docs with a developer-friendly workflow for creating and maintaining documentation. In this article, we’ll focus on how to extend Redocly’s API Docs tool by incorporating SDKs generated by APIMatic.
At APIMatic, we generate strongly typed SDKs along with language-specific documentation and code samples, all built from OpenAPI definitions.
In this post, we’ll look at how APIMatic-generated SDKs can be embedded into Redocly’s API Reference solution to elevate the API Integration experience for your developers. This screenshot shows what we are going to build in this tutorial:
This article assumes you have already signed up to Redocly, set up your GitHub repository, connected it to Redocly’s API registry and added your API definition to the registry. If not then follow the Redocly API registry quickstart guide.
It’s easy to get started with APIMatic, just follow the steps below. If you already have a generated portal with APIMatic, skip to the next section.
Next, publish your SDK documentation so it is publicly accessible. Click the Customize button on the banner that appears at the bottom of your screen.
Let’s insert APIMatic SDKs into your Redocly API docs.
Redocly API docs render the main description of an API definition as a separate section. We will leverage this capability to create an SDK section at the beginning of our API Docs.
Open your Redocly Source Directory and navigate to your OpenAPI Description file. If you used the sample GitHub Repository provided by Redocly, this should be the openapi/openapi.yaml file.
Find the info -> description property and determine if the value is provided inline or contains a $ref link to a separate markdown file. In the case of the latter, you can skip down to use our API description template.
Create a new markdown page in your repository named api-description.md inside the openapi/ directory.
Copy the info -> description value from the OpenAPI spec file and paste it into the newly created api-description.md file to retain the original description.
Now update the info -> description property in the OpenAPI spec by adding a $ref property to it with the correct path to the api-description.md file as shown in the screenshot below.
We’ve created a markdown template to help you add your APIMatic SDKs to your Redocly API Docs. Copy the contents of the template from here and paste them inside the api-description.md file after your original description text.
https://www.apimatic.io/apidocs/YOUR DOCS SLUG. Replace all instances of YOUR DOCS SLUG in the api-description.md file with this value. API KEY. In the api-description.md file, replace all instances of YOUR API KEY with this value.🎉 Congratulations, you have successfully embedded APIMatic SDKs inside your Redocly API Docs.
The foundation of a good API program is documentation. As your developer audience expands, the need for an SDK program becomes a priority. It’s great to have flexibility when choosing from an array of tools to build your overall developer experience.
APIMatic provides an extensible code generation solution that works with virtually every documentation solution on the market. If you’ve liked what you read, sign up for a free 14-day trial of APIMatic and get started!
We would love to see what you build. Tweet your updated Redocly docs to us at @APIMatic or drop a mention on Linkedin.