Web APIs may have constraints on parameters, such that not all parameters are either always required or always optional. Moreover, the presence or value of one parameter could cause another parameter to be required, or parameters could have restrictions on what kinds of values are valid. Having a clear overview of the constraints helps API consumers to integrate without the need for additional support and with fewer integration faults. We made use of existing documentation and code analysis approaches for identifying parameter constraints in complex web APIs. In this paper, we report our case study of several APIs at Adyen, a large-scale payment company that offers complex Web APIs to its customers. Our results show that the documentation- and code-based approach can identify 23% and 53% of the constraints respectively and, when combined, 68% of them. We also reflect on the current challenges that these approaches face. In particular, the absence of information that explicitly describes the constraints in the documentation (in the documentation analysis), and the engineering of a sound static code analyser that is sensitive to data-flow, maintains longer parameter references throughout the API's code, and that is able to symbolically execute the several libraries and frameworks used by the API (in the static analysis).
翻译:网页API可能会对参数有限制,因此并非所有参数都总是需要或总是有选择。此外,一个参数的存在或价值可能导致需要另一个参数,或参数可能对何种值有效有限制。如果对这些制约因素有一个清楚的概览,就会帮助API消费者在不需要额外支持和一体化缺陷较少的情况下整合。我们利用现有的文档和代码分析方法来确定复杂的网络API的参数限制。在本文中,我们报告了我们对Adyen的多个固定代码分析器的案例研究,Adyen是一家大型支付公司,向客户提供复杂的网络API。我们的结果表明,基于文件和代码的方法可以分别确定23%和53%的限制,加起来,68%的限制。我们还反思了这些方法目前面临的挑战。特别是,缺乏明确描述文件(在文件分析中)限制的信息,并且没有对数据流敏感的可靠固定代码分析器的工程设计,在整个API代码中保持更长的参数参考,并且能够象征性地执行一些静态图书馆和框架(在API中使用的静态分析)。