Published on

Integrate APIs using AI via CLI

Authors
  • Martyn Davies
    Name
    Martyn Davies
    Title
    Head of Developer Relations
    Social media profiles

Imagine a workflow that allows developers to focus on building great applications, rather than getting bogged down in the details of integrating with third-party services. What if something else could read and understand the documentation for them?

That workflow is coming. We’re excited to share the first technology preview of the new Superface CLI.

The CLI (which we fondly refer to as EDGAR) is a powerful tool that allows developers to integrate with third-party APIs directly from the command line. Designed to help developers save time and effort by providing them with a powerful AI analysis that allows them to generate working integration code for their applications using the documentation of the provider they want to integrate with.

You can see more about how it works in the technology preview video below.

How the Superface CLI works

Superface harnesses the power of AI to analyze API documentation.

Currently, APIs defined with an Open API Specification (OAS) document, or hosted by Readme.io, can be ingested but we’re soon going to allow you to provide any documentation you want, in any text based format you have.

Below we ingest the OAS for the Resend.com email API directly from a GitHub repo.

npm run ingest https://raw.githubusercontent.com/resendlabs/resend-openapi/main/resend.yaml

Once ingested into the system, you can create working integration code for your desired API by stating the use case you want to achieve. For example, “send an email”, “return geolocation from an IP address” or “translate from English to Czech”.

npm run resend "send an email"

With this use case, Superface will analyze the documentation and create a plan for how the API should be used in order to achieve it. The map command starts this process.

npm run map

This plan can then be turned into working integration code that runs via the Superface OneSDK. It’s important to highlight that this isn’t chatbot-to-code, as you have full code-like control over the files that are generated and can edit them to tune the output should you need to.

Additionally, we’ve included a specific command that allows you to run what the CLI generated against the third party API you want to work with, to check that it works and show you a real success or failure response.

npm run execute ./email-communication/email-sending/email-communication.email-sending.resend.map.js

This will run the code the CLI generated for you directly against the API, with no middleman or proxy, and output the response.

Overall, creating the integration you want breaks down to just 4 steps:

  1. Ingest the API documentation into the system.
  2. State the desired use case (e.g. "send an email").
  3. Superface will analyze the documentation and generate a plan for how to call the API to achieve the use case.
  4. The plan is turned into working integration code that runs via the Superface OneSDK.

At this time, all of these steps can be completed using the CLI, using AI to give you full, fast, control over your API integration workflow.

Register for early access

Superface CLI will soon be available for early access users. If you'd like to try it, go to superface.ai/cli and let us know. We're excited to hear what you think.

Connect your GPT to APIs for free.
Superface. The super interface for all your platforms.

Try it now