IP Library Granted Patent US 12688039
Granted Patent B2
US 12688039 · App. 18/051,388 · Granted Jul 21, 2026

Implementation and interpretation of API routing domain-specific language

Inventors: Datong Sun (Shanghai, CN); Chrono Luo (Shanghai, CN)
Assignee: KONG INC.
G06F9/30029G06F9/3017G06F9/541G06F9/547
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12688039
App. No.
18/051,388
Granted
Jul 21, 2026
Kind
B2
Abstract

Disclosed embodiments relate to implementation and interpretation of an application programming interface (API) routing domain-specific programming language (DSL). The API routing DSL improves storage efficiency of routing definitions and rules, reduces errors for API messages unmatched to routes, and improves runtime performance for API message routing. In example embodiments, a routing data object configured according to the API routing DSL includes a match expression. The match expression is a logical combination of one or more attribute condition statements that each describe a relational comparison between an API message attribute and a specified value. Evaluation of the match expression as logically true using attributes of a given API message indicates that the given API messages matches the routing data object. The given API message is then routed according to an endpoint and/or policies associated with the routing data object.

Claims (80)

1 . A method for routing application programming interface (API) requests within a microservices architecture, the method comprising:

receiving an API request that includes a plurality of message attributes;

accessing a plurality of routing data objects according to a domain-specific programming language, each routing data object being associated with an upstream API of the microservices architecture and including a match expression,

wherein the match expression includes a logical combination of one or more attribute condition statements using one or more Boolean operators,

wherein evaluation of the match expression produces a single output indicating whether the API request matches the routing data object,

wherein each attribute condition statement is specific to a message attribute and is defined by a data value and a relational operator by which the message attribute is compared to the data value, and

wherein the relational operator of each attribute condition statement is one of a set of operators that is specific to a data type of the message attribute;

performing at least one matching operation between the API request and the plurality of routing data objects,

wherein each matching operation for a given one of the plurality of routing data objects includes:

evaluating, with the plurality of message attributes of the API request, the one or more attribute condition statements of the match expression of the given one of the plurality of routing data objects, and

determining whether the match expression is logically true according to the logical combination of the one or more attribute condition statements;

based on performing the at least one matching operation, identifying a particular routing data object that matches the API request based on the match expression of the particular routing data object being logically true with the plurality of message attributes of the API request; and

routing the API request to a particular upstream API according to the particular routing data object.

2 . The method of claim 1 , wherein the at least one matching operation includes multiple matching operations that are performed sequentially according to a priority value associated with each routing data object of the plurality of routing data objects.

3 . The method of claim 2 , wherein the multiple matching operations are performed sequentially further according to a time at which each routing data object was defined.

4 . The method of claim 1 , wherein the relational operator of each attribute condition statement is one of a set of operators that is specific to a data type of the message attribute to which the attribute condition statement is specific.

5 . The method of claim 4 , wherein based on the data type being a string data type, the set of operators includes an equality operator, an inequality operator, a partial-matching operator, a contains operator, and a Regex-matching operator.

6 . The method of claim 4 , wherein based on the data type being a numerical data type, the relational operator is either an equality operator or an inequality operator.

7 . The method of claim 1 , further comprising reducing a number of routing data objects included in the plurality of routing data objects based on:

determining that two routing data objects of the plurality of routing data objects are combinable, and

defining a combined routing data object to replace the two routing data objects,

wherein the combined routing data object includes a combined match expression that includes a logical combination, via an OR Boolean operator, of respective match expressions of the two routing data objects.

8 . The method of claim 7 , wherein the two routing data objects are combinable based on the two routing data objects being associated with a same upstream application.

9 . An API router comprising:

at least one data processor; and

a memory storing instructions that, when executed by the at least one data processor, cause the API router to:

define, for each of a plurality of services, one or more routing data objects according to a domain-specific programming language, each including a match expression that is a logical combination of one or more attribute condition statements using one or more Boolean operators,

wherein evaluation of the match expression produces a single output indicating whether a given API message matches the one or more routing data objects,

wherein each attribute condition statement is specific to a message attribute and includes a data value and a relational operator by the message attribute is compared to the data value, and wherein the relational operator of each attribute condition statement is one of a set of operators that is specific to a data type of the message attribute;

perform at least one matching operation between a first API message and a plurality of routing data objects,

wherein each matching operation for a given one of the plurality of routing data objects includes:

evaluating, with the message attributes of the first API message, the one or more attribute condition statements of the match expression of the given one of the plurality of routing data objects, and

determining whether the match expression is logically true according to the logical combination of the one or more attribute condition statements;

based on performing the at least one matching operation, identify a particular routing data object that matches the first API message based on the match expression of the particular routing data object being logically true with the message attributes of the first API message; and

route the given API message according to one or more policies associated with the particular routing data object.

10 . The API router of claim 9 , wherein identifying the particular routing data object includes sequentially performing at least one matching operation between the given API message and one of a group of routing data objects.

11 . The API router of claim 10 , wherein the at least one matching operation includes multiple matching operations that are sequentially performed according to a priority value associated with each routing data object.

12 . The API router of claim 9 , wherein the relational operator of each attribute condition statement is one of a set of operators that is specific to a data type associated with the attribute condition statement.

13 . The API router of claim 9 , wherein an attribute condition statement further includes a transformation function that transforms the attribute compared to the data value.

14 . The API router of claim 9 , wherein defining the one or more routing data objects includes defining a combined routing data object from two routing data objects, the combined routing data object including a combined match expression that combines respective match expressions of the two routing data objects via an OR Boolean operator.

15 . A platform implemented by a computing system comprising:

at least one processor; and

at least one memory including instructions that when executed cause the at least one processor to execute:

a plurality of services; and

an API gateway configured to route API messages to or from the plurality of services, the API gateway configured to:

store, in the at least one memory, a plurality of routing data objects each associated with one of the plurality of services according to a domain-specific programming language,

wherein each routing data object includes a match expression that logically combines one or more attribute condition statements using one or more Boolean operators,

wherein evaluation of the match expression produces a single output indicating whether a given API message matches the one or more routing data objects,

wherein each attribute condition statement is specific to a message attribute and includes a data value and a relational operator by which the message attribute is compared to the data value, and

wherein the relational operator of each attribute condition statement is one of a set of operators that is specific to a data type of the message attribute,

perform at least one matching operation between the given API message and the plurality of routing data objects,

wherein each matching operation for a given one of the plurality of routing data objects includes:

evaluating, with the message attributes of the given API message, the one or more attribute condition statements of the match expression of the given one of the plurality of routing data objects, and

determining whether the match expression is logically true according to the logical combination of the one or more attribute condition statements,

based on performing the at least one matching operation, identify a particular routing data object that matches the given API message based on the match expression of the particular routing data object being logically true with the message attributes of the given API message,

route the given API message to or from a particular service according to the particular routing data object.

16 . The platform of claim 15 , wherein the API gateway matches the given API message to the particular routing data object by sequentially performing multiple matching operations between the given API message and one of the plurality of routing data objects.

17 . The platform of claim 15 , wherein the relational operator of each attribute condition statement is one of a set of operators that is specific to a data type of the data value of the attribute condition statement.

18 . The platform of claim 15 , wherein the API gateway routes the given API message according to one or more policies associated with the particular routing data object, wherein the one or more policies include one or more of a rate-limiting policy, an authentication or security policy, a geolocation policy, or an IP-specific policy.

19 . The platform of claim 15 , wherein the API gateway stores the plurality of routing data objects by optimizing the plurality of routing data objects by combining two routing data objects that correspond to a same service, wherein the two routing data objects are combined via a combined match expression that combines, with an OR Boolean operator, each match expression of the two routing data objects.

20 . The platform of claim 15 , wherein the API gateway is configured to store a given routing data object in response to receiving a particular API request for an administrative service, the particular API request defining the match expression for the given routing data object.

21 . A router configured to execute instructions for interpreting a domain-specific programming language, the router comprising:

at least one processor; and

at least one memory including the instructions, wherein the instructions when executed cause the router to interpret aspects of the domain-specific programming language including:

a set of attributes each indicated by a particular data string and each relating to an aspect of API messages received at the router;

a set of relational operators that each define a comparison between a given attribute and a given data value, wherein each relational operator is one of a set of operators that is specific to a data type of the given attribute;

an attribute condition statement composed of an attribute, a relational operator, and a data value against which the attribute is compared according to the relational operator; and

execution of matching operations between a given API message and a plurality of routing data objects,

wherein each matching operation for a given one of the plurality of routing data objects includes:

evaluating, with the message attributes of the given API message, the attribute condition statement of a match expression of the given one of the plurality of routing data objects, and

determining whether the match expression is logically true according to a logical combination of the attribute condition statement,

based on the execution of matching operations, the router identifies a particular routing data object that matches the given API message based on the match expression of the particular routing data object being logically true with the message attributes of the given API message;

a set of combinatorial operators each configured to logically combine two attribute condition statements to form a match expression that results in one logical output indicating whether an API message matches a routing data object.

22 . The router of claim 21 , wherein the instructions when executed further cause the router to:

in response to receiving a request to create a routing data object in accordance with the domain-specific programming language, determine whether, in a given attribute condition statement included in the request, a given relational operator is associated with a same data type as a given attribute; and

based on the given relational operator being associated with a different data type than the given attribute, indicating an error code in response to the request.

23 . The router of claim 21 , wherein the instructions when executed further cause the router to:

in response to receiving a request to create a routing data object in accordance with the domain-specific programming language, determine whether a given attribute condition statement included in the request satisfies a pre-defined form; and

based on the given attribute condition statement not satisfying the pre-defined form, indicating an error code in response to the request.

24 . The router of claim 23 , wherein the pre-defined form is attribute operator value.