Probabilistic API Matching for Ambiguous Code Usage
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Developers face challenges in accurately matching API code usage with corresponding API specifications due to missing or ambiguous information, such as obfuscated URL/HTTP method/data, uninitialized base URLs, and non-unique API versions, leading to runtime errors and difficulties in identifying deprecated APIs or unsupported services.
Innovation Solution
A probabilistic approach is implemented to match API code usage with API specifications by extracting features like schema, HTTP method, host, and query parameters, using text matching, classification via machine learning, or clustering, and determining a match probability to identify the most likely API specification, allowing communication with the correct endpoint.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If exact matching is used between API code usage and API specifications, then matching precision is high, but the system cannot handle missing or ambiguous information leading to match failures
Solution Approach 1:
The system changes the matching parameter from binary exact match to probabilistic similarity scoring. Instead of requiring complete feature matches, the system calculates match probabilities based on available features and selects the API specification with the highest probability, even when information is missing or ambiguous.
Solution Approach 2:
The system performs partial matching by comparing only the features that are present in the API code usage against API specifications. It does not require all features to be matched, allowing successful matching even with incomplete information, while still maintaining reasonable precision through probability calculation.
2Reliability
If probabilistic matching is implemented to handle ambiguous information, then reliability improves, but matching precision may decrease due to potential false matches
Solution Approach 1:
The system uses feedback mechanisms by comparing the calculated match probabilities against threshold values and allowing developers to provide feedback on match accuracy. This feedback is used to refine the matching algorithm and adjust thresholds, improving precision over time while maintaining high reliability.
Solution Approach 2:
The system replaces traditional mechanical exact-matching mechanisms with probabilistic and machine learning-based approaches. Instead of rigid feature-by-feature comparison, the system uses similarity algorithms and trained models to determine match likelihood, achieving both reliability and precision through intelligent computation.
3Measurement precision
If multiple API specifications are compared to find the best match, then matching accuracy improves, but computational complexity increases
Solution Approach 1:
The system segments the matching process into distinct phases: first filtering API specifications based on key features like host and HTTP method, then performing detailed probabilistic comparison only on the filtered subset. This segmentation reduces the number of full comparisons needed, lowering computational complexity while maintaining accuracy.
Solution Approach 2:
The system performs preliminary filtering and feature extraction before the main matching process. By pre-processing the API specifications and code usage to extract and normalize features, the system reduces the complexity of the subsequent probabilistic comparison, making the overall process more efficient.
4Adaptability or versatility
If feature extraction from API code usage is performed to enable matching, then matching capability is enabled, but processing time increases
Solution Approach 1:
The system extracts only the essential features from API code usage that are necessary for matching, such as host, HTTP method, and path segments. By selectively extracting only the most relevant features rather than analyzing the entire code, the system enables comprehensive matching capability while minimizing processing time.
Data Source
AI summary
A method and system of matching an application program interface (API) code usage with an API specification are provided. A program having an API code usage is received and its features are extracted therefrom. Features from meta data of a plurality of API specifications are extracted. For each API specification of the plurality of API specifications, a match probability with the API code usage is determined. An API specification having a highest probability is determined. The API code usage is matched with the API specification having the highest probability.


