arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1801.08928cs.SE
收藏

从HTML文档中自动提取Web API规范

Automatically Extracting Web API Specifications from HTML Documentation

Jinqiu Yang, Erik Wittern, Annie T. T. Ying, Julian Dolby, Lin Tan

摘要:

Web API规范是机器可读的API描述。这些规范与相关工具相结合,简化并支持API的使用。然而,尽管Web API的分布越来越多,但规范很少,其创建和维护严重依赖于第三方的手动工作。在本文中,我们提出了一个自动的方法和相关的工具,称为D2 Spec提取规范的Web API文档页面。给定API上的种子在线文档页面,D2 Spec首先爬取API上的所有文档页面,然后使用一组机器学习技术来提取基本URL、路径模板和HTTP方法,它们共同描述API的端点。我们评估了D2 Spec是否可以从120个Web API的文档中准确提取端点。实验结果表明,D2 Spec对基本URL的识别准确率为87.5%,对路径模板的生成准确率为81.3%,召回率为80.6%,对HTTP方法的提取准确率为84.4%,召回率为76.2%。此外,我们发现D2 Spec在应用于已有API规范的API时很有用:D2 Spec揭示了Web API文档与其相应的公开规范之间的许多不一致之处。因此,Web API提供商可以使用D2 Spec来保持文档和规范的同步。

英文摘要:

Web API specifications are machine-readable descriptions of APIs. These specifications, in combination with related tooling, simplify and support the consumption of APIs. However, despite the increased distribution of web APIs, specifications are rare and their creation and maintenance heavily relies on manual efforts by third parties. In this paper, we propose an automatic approach and an associated tool called D2Spec for extracting specifications from web API documentation pages. Given a seed online documentation page on an API, D2Spec first crawls all documentation pages on the API, and then uses a set of machine learning techniques to extract the base URL, path templates, and HTTP methods, which collectively describe the endpoints of an API. We evaluated whether D2Spec can accurately extract endpoints from documentation on 120 web APIs. The results showed that D2Spec achieved a precision of 87.5% in identifying base URLs, a precision of 81.3% and a recall of 80.6% in generating path templates, and a precision of 84.4% and a recall of 76.2% in extracting HTTP methods. In addition, we found that D2Spec was useful when applied to APIs with pre-existing API specifications: D2Spec revealed many inconsistencies between web API documentation and their corresponding publicly available specifications. Thus, D2Spec can be used by web API providers to keep documentation and specifications in synchronization.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑