Integrate APIs using AI via CLI

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?

Th…


This content originally appeared on DEV Community and was authored by Martyn Davies

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.

Subscribe to get early access


This content originally appeared on DEV Community and was authored by Martyn Davies


Print Share Comment Cite Upload Translate Updates
APA

Martyn Davies | Sciencx (2023-06-05T07:54:35+00:00) Integrate APIs using AI via CLI. Retrieved from https://www.scien.cx/2023/06/05/integrate-apis-using-ai-via-cli/

MLA
" » Integrate APIs using AI via CLI." Martyn Davies | Sciencx - Monday June 5, 2023, https://www.scien.cx/2023/06/05/integrate-apis-using-ai-via-cli/
HARVARD
Martyn Davies | Sciencx Monday June 5, 2023 » Integrate APIs using AI via CLI., viewed ,<https://www.scien.cx/2023/06/05/integrate-apis-using-ai-via-cli/>
VANCOUVER
Martyn Davies | Sciencx - » Integrate APIs using AI via CLI. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/06/05/integrate-apis-using-ai-via-cli/
CHICAGO
" » Integrate APIs using AI via CLI." Martyn Davies | Sciencx - Accessed . https://www.scien.cx/2023/06/05/integrate-apis-using-ai-via-cli/
IEEE
" » Integrate APIs using AI via CLI." Martyn Davies | Sciencx [Online]. Available: https://www.scien.cx/2023/06/05/integrate-apis-using-ai-via-cli/. [Accessed: ]
rf:citation
» Integrate APIs using AI via CLI | Martyn Davies | Sciencx | https://www.scien.cx/2023/06/05/integrate-apis-using-ai-via-cli/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.