Tahira J. Khattak October 11, 2023

sdk-publishing-cover-imageWe’re APIMatic.io. We generate strongly typed SDKs along with a complete API reference from OpenAPI definitions. If you’re looking to create an SDK for your REST API, check out how to generate one in under a minute. This post covers our improved SDK Publishing feature and how it makes life easier for API providers when it comes to publishing libraries to package registries and source code to GitHub.

APIMatic’s improved SDK Publishing feature allows API providers to directly publish their SDKs in multiple languages to the most popular package registries, including Maven, Nuget, npm, Packagist, PyPi and RubyGems. This new feature saves time for API providers by automating the publishing process and for API consumers by making SDK installation even easier.

APIMatic-generated SDKs are already available in the following ways:

  • Download the SDK code as a ZIP file
  • Publish SDK code to GitHub

Developers expect to install and manage SDKs as dependencies through popular package managers. Prior to this release, API providers either needed to manually publish these SDKs to package registries or set up complex scripts as part of their CI/CD pipeline to automate this process.

Publishing SDKs and automating the process requires expertise and knowledge of relevant best practices in multiple languages as well as the know-how to set up CI/CD pipelines.  We heard from our customers that this was challenging. Many did not have the expertise in-house to configure package registries in all the languages or had constraints regarding access to DevOps for setting up CI/CD pipelines.

We understand that doing this correctly is time-consuming, costly, and not to mention, an extensively meticulous process. We recognized this was a barrier for APIMatic customers who wanted to meet the needs of their developers without investing a lot of time and effort.

 

 

Hello, APIMatic SDK Publishing.

The SDK Publishing feature removes the aforementioned bottlenecks.

  • Minimizing the effort to configure package publishing details for 6 different languages.
  • Compiling SDKs, and publishing them to package registries.
  • Publishing SDK source to GitHub simultaneously.
  • Updating your API Portal with instructions for newly published packages.

Without SDK Publishing, users would need to be well-equipped with the expertise and tools to manage the process for each of the languages. For instance, they would need to have separate toolchains (compilers) installed and know which commands to run, compile, and publish the SDKs in each language.

Additionally, APIMatic customers have the option to publish SDK source code to Github at the same time.

Let’s explore the advantages of using package registries for API providers as well as API consumers.

Benefits for API Providers

Increased visibility

Most package registries include a search feature that allows developers to find packages by name. For example, searching “Stripe Payment SDK” would surface Stripe’s package.

Another feature is the option of creating tags, which can enhance discoverability further by having the package be associated with various categories. Examples of categories would be payment, logistics, e-commerce, etc. If you publish an SDK to npm and tag it with the keyword ‘payments’, users can find it while searching for ‘payments’. Moreover, some platforms, such as npmjs.org, publicly display the frequency of library downloads. Significant download numbers signal to users other developers find the library useful which builds credibility for the API provider.

Improved security

Publishing an SDK to a package registry helps improve security by enabling easy distribution of security patches and updates. This ensures API consumers can quickly receive and apply critical security fixes without manually updating and building the SDK from the source code.

Platforms like npm also perform vulnerability audits on packages and their dependencies. On one hand, this helps SDK providers discover security issues in their packages while on the other hand, it allows SDK consumers to view a detailed audit report before installing new packages. This discourages the onslaught of vulnerabilities in their applications. With APIMatic, security fixes are pushed to your developers through publishing packages along with regular updates APIMatic makes to our core libraries.

Benefits for API Consumers

Easy installation and setup

Compared to manually downloading the source code and setting it up, users can easily install and set up the library published to a package registry with a few simple commands. For instance, users can easily install Stripe's JavaScript SDK using the "npm install stripe". The alternative would have been to download the source code from GitHub, manually add it to a project, build it and install all its dependencies.

Developer tool integration

Package Managers often have integrations with other tools and services in the software development ecosystem. Many code editors and IDEs have plugins that make it easy to install and use libraries that are published on Package Registries. By publishing your SDK to a package registry, you can take advantage of these integrations and make it easier for API consumers to incorporate your SDK into their development workflow.

This is not all. Additional benefits include better SDK version management, dependency tracking, and notification of depreciation of SDK versions over time.

So, how does it work?

From APIMatic’s dashboard, you’ll locate your imported API definition and click the Generate button. From the options provided, select Publish Package. The first time through you’ll be prompted to configure a publish profile by following an easy 3-step process.

Step 1: Name your profile

Enter your new Publish Profile name

Step 2: General information

Enter general information about your company and package. We’ll use this information in step 3 to generate smart defaults for each language Package Registry.

SDK publishing blog - draft-4

Step 3: Setup package information for each language

For each language, you will add your package details such as the name and description of the package. You will also add your package registry credentials. Don’t worry, we’ve got you covered. Clicking the New Credential button opens a window that includes step-by-step instructions to obtain your API keys and any other relevant information to configure your credentials. Next, review the populated values to confirm they are meaningful and work for your developer audience. Lastly, if you choose to publish SDK source code to GitHub, you’ll want to add those credentials by connecting to GitHub. Repeat this process for each language to complete your publish profile setup.

Let’s see where the published packages go for each language:

Table showing relevant package registries for C#, Java, PHP, Python, Ruby, TypeScript

Publish Packages and Source Code

Once the settings are saved, you will select an API version, confirm the publish profile, enter a package version, and click Publish Packages and Source Code.

Form displaying API Version, Publish Profile, and  Package Versions with a Publish Packages and Source Code button

A few minutes later, Voilà! The packages are published to all the package registries you’ve configured along with their source code which is pushed to GitHub.

Successfully published SDKs with action options to view logs, source code, and download SDK

Sync with portal and update your docs

To update your documentation with the package installation instructions, click on Sync with Portal button. Your generated getting started guide will now feature instructions for using a package manager to install the SDK.

Updated portal with SDK install command

To see how this feature works, take a look at APIMatic's new package publishing video. It walks you through the seamless process of creating an SDK and publishing it to package registries in less than 4 minutes!

For more detailed instructions, check out the docs.

More Publishing Goodies

Besides the intuitive UI and time-saving steps, here are some more goodies you get with our APIMatic’s package publishing feature:

Publish logs

Logs are generated for all SDKs published to package registries. This supports consumers and providers alike in any inspection or debugging requirements.

Improved source code publishing

Your source code is published automatically to your GitHub repository, which helps you maintain your code versions without any manual effort, other than providing your GitHub details, of course.

Publish one or more SDK languages

The best part is that in the same settings, you get to pick and choose if you want to publish your code in one language or multiple languages. If you choose the latter, the packages get published simultaneously without any delay.

Publish SDKs with different versions

You get complete control over versioning your APIs and packages published to popular registries. It is easier to track and maintain versions as needed.

Keeping docs synced

By syncing the published packages to your docs portal, you get your docs updated automatically without manual intervention or extra work.

Conclusion

SDK publishing eliminates the cumbersome processes of manually publishing SDKs and maintaining these in multiple languages. The best part is, with just a few clicks and an intuitive interface, you can publish your code to multiple registries in one go. All of this without the need to invest in engineering resources or ongoing maintenance costs.

The SDK publishing feature is available as a trial version. To experience the goodness, sign up on APIMatic, if you have not already and explore it!

P.S. Let us know what you think