Automatically generating application programming interfaces
Techniques for automatically generating an API in response to a natural language input are provided. A method includes: receiving, by a processor set, a natural language input provided via a conversational user interface of a client device; determining, by the processor set, requirements of a new application programming interface (API) by analyzing the natural language input using natural language understanding; and automatically generating, by the processor set, the new API based on the requirements.
1 . A method, comprising:
receiving, by a processor set, a natural language input provided via a conversational user interface of a client device;
determining, by the processor set, first data, second data, and a joint field by analyzing the natural language input using natural language understanding by matching tokens to metadata tags; and
automatically generating, by the processor set, source code for a new application programming interface (API) that is a composition of a first API that returns the first data and the joint field and a second API that returns the second data and the joint field, wherein the new API returns the first data and the second data joined on the joint field.
2 . The method of claim 1 , wherein the new API comprises a representational state transfer (REST) API.
3 . The method of claim 1 , wherein the new API comprises a simple object access protocol (SOAP) API.
4 . The method of claim 1 , wherein:
the first API and the second API are selected from a list of multiple APIs created by respective auto-generator modules associated with respective data sources.
5 . The method of claim 1 , wherein:
the method further comprises determining a limiting operator by analyzing the natural language input using natural language understanding; and
the new API limits the return of the first data and the second data based on the limiting operator.
6 . The method of claim 1 , further comprising automatically deploying the new API in a production environment by generating infrastructure for the new API on a cloud or on-premises system.
7 . The method of claim 6 , wherein the generating infrastructure for the new API comprises creating and executing a script that deploys the source code of the new API on a service in a target infrastructure.
8 . A computer program product comprising one or more computer readable storage media having program instructions collectively stored on the one or more computer readable storage media, the program instructions executable to:
receive a natural language input requesting that a new application programming interface (API) be generated, the natural language input being provided via a conversational user interface of a client device;
determine first data, second data, a joint field, and a limiting operator of a new application programming interface (API) by analyzing the natural language input using natural language understanding, wherein the natural language understanding utilizes a machine learning classification model that is trained to classify the natural language input into various different intents by matching tokens to metadata tags; and
automatically generate source code of the new API, wherein the new API is a composition of a first API that returns the first data and the joint field and a second API that returns the second data and the joint field, and wherein the new API returns the first data and the second data joined on the joint field.
9 . The computer program product of claim 8 , wherein the new API comprises one of a representational state transfer (REST) API and a simple object access protocol (SOAP) API.
10 . The computer program product of claim 8 , wherein:
the first API and the second API are selected from a list of multiple APIs created by auto-generator modules that are configured to generate web services that expose data in multiple data sources; and
the list is tagged with metadata that describes which respective ones of the data sources that are exposed by respective ones of the multiple APIs in the list.
11 . The computer program product of claim 8 , wherein:
the limiting operator comprises a filter that limits an amount of data returned by the new API; and
the new API limits the return of the first data and the second data based on the limiting operator.
12 . A system comprising:
a processor set, one or more computer readable storage media, and program instructions collectively stored on the one or more computer readable storage media, the program instructions executable to:
receive a natural language input provided via a conversational user interface of a client device;
determine first data, second data, a joint field, and a limiting operator of a new application programming interface (API) by analyzing the natural language input using natural language understanding intents by matching tokens in the requirements to metadata tags, wherein the natural language understanding utilizes preprocessing text of the natural language input by tokenizing a sentence and removing stop words, and then matches the tokens from the natural language input to metadata tags from a list of multiple APIs;
automatically generate, by automated API generation code, source code for the new API, wherein the new API is a composition of a first API that returns the first data and the joint field and a second API that returns the second data and the joint field, and wherein the new API returns the first data and the second data joined on the joint field.
13 . The system of claim 12 , wherein the new API comprises one of a representational state transfer (REST) API and a simple object access protocol (SOAP) API.
14 . The system of claim 12 , wherein:
the first API and the second API are selected from the list of multiple APIs created by respective auto-generator modules comprising: a first auto-generator module associated with an SQL database; a second auto-generator module associated with a message broker; and a third auto-generator module associated with a NoSQL database; and
the auto-generator modules automatically generate at least one web service that exposes data in multiple data sources.
15 . The system of claim 12 , wherein:
the limiting operator comprises a filter that limits an amount of data returned by the new API; and
the new API limits the return of the first data and the second data based on the limiting operator.