With the introduction of service-oriented architectures and the development of Internet technology, more services can be published, searched, and invoked through the Internet. More developers choose to reuse existing services instead of redevelopment. After the REST architecture style was brought up, web services gradually turned to be designed as RESTful APIs, which are lighter and easier to understand. The platforms for service registry and discovery have also moved from UDDI to some mainstream API markets, such as Programmable Web and Rapid API. The explosive growth of the number of services brings more choices to the users, while at the same time, it brings out a new challenge: how can users efficiently find the API services meeting their requirements?
The change of service form leads to the change of service discovery research object from SOAP-based services to RESTful APIs and mashups[1][2]. However, most WSDL-based service discovery methods adopt keyword-matching technologies, which cannot assure discovery accuracy[3]. Ontology-based semantic service description languages are then introduced to help with the understanding of parameters. However, RESTful APIs do not provide corresponding semantic annotations, which makes it difficult for SOAP-based methods to be migrated to the API scenario. In the meantime, most of the API discovery research[4] focuses on improving natural language processing technologies to understand the description better, which ignores the service callability. Therefore, it is necessary to propose a RESTful API-oriented service discovery method considering both the function description and interfaces.
To achieve this, we turn to the world’s largest API hub, Rapid API[5]. On this platform, besides the functional description text of APIs, the interface and performance information can also be automatically collected. Based on Rapid API, we notice three new features of RESTful API interfaces in aspects of interface design and parameter matching:
- Firstly, many abbreviations can be noticed in the parameters. The usage of abbreviations is quite common during the developers’ coding processes. However, due to the lack of semantic annotations, this can greatly affect the accuracy of interface matching.
- Secondly, input parameters can have different necessities as required or optional, which affects their importance during matching. If any required input data of the discovered API cannot be fulfilled by the data provided by the user, it cannot be called. And if the optional input parameters of an API are designed to support more input data from the user, this indicates that the API can satisfy more requirements of the users, like the language of the response data, etc.
- The third one is about matching relationships. There may have one-to-many matches between parameters. For example, when a weather forecast service needs coordinate as input, the data provided by the user may be two separate parameters, latitude and longitude. We all know that coordinate refers to the combination of latitude and longitude. In this case, both provided data should be assigned to coordinate.
These features can affect the discovery accuracy to a certain extent. However, most existing work ignores their existence. Therefore, we propose an automated RESTful API service discovery framework considering both the description texts and interfaces. And also, based on the three newly-noticed RESTful API features of interface design and parameter matching, we present an interface preprocessing and matching strategy. Interface preprocessing consists of interface transformation and identifier expansion to deal with parameter abbreviations. About the matching strategy, required and optional input parameters are matched with different importance, and one-to-many parameter matching relationships are allowed in this scheme. The overall framework is shown in Figure 1.
Based on the dataset collected from Rapid API, we conducted comparative experiments to verify the effect of our research. It can be shown that the proposed method is more suitable for automated RESTful API service discovery with various interface features. Better results are reflected in three metrics, which are shown in Figure 2 and Figure 3.
In the meantime, the discovery platform based on our research is now accessible. Figure 4 shows an example of using the platform. Since we believe that the further promotion of the study on API service discovery is limited for lacking data from users, we welcome you to try it out and provide feedback on the discovery results.
References
[1] Ma, S.P., Chen, Y.J., Syu, Y., Lin, H.J., Fanjiang, Y.Y.: Test-oriented restful service discovery with semantic interface compatibility. IEEE Transactions on Services Computing 14(5), 1571–1584 (2018)
[2] Azmy, M.R., Muhamad, W., et al.: Advanced technologies to support service discovery in service-oriented systems. In: 2020 International Conference on Information Technology Systems and Innovation (ICITSI). pp. 300–305. IEEE (2020)
[3] Paliwal, A.V., Shafiq, B., Vaidya, J., Xiong, H., Adam, N.: Semantics-based automated service discovery. IEEE Transactions on Services Computing 5(2), 260–275(2011)
[4] Liu, L., Bahrami, M., Park, J., Chen, W.P.: Web api search: Discover web api and its endpoint with natural language queries. In: International Conference on Web Services. pp. 96–113. Springer (2020)
[5] RapidAPI: What is rapidapi? https://docs.rapidapi.com/docs/what-is-rapidapi/
Authors
ShuaiJun Wang received the B.S. degree from Ocean University of China, Qingdao, China, in 2020. She is pursuing the M.S. degree in the Department of Computer Science and Technology, Tongji University, Shanghai, China. Her current research interests include service computing and microservices.
YuanYuan Zhou received the M.S. degree in Computer Science and Technology from Anhui University, Hefei, China, in 2019. She is pursuing the Ph.D. degree in the Department of Computer Science and Technology, Tongji University, Shanghai, China. Her current research interests include service computing and microservices.
ZhiJun Ding (Senior Member, IEEE) received the Ph.D. degree from Tongji University, Shanghai, China, in 2007. Currently he is a professor with the Department of Computer Science and Technology, Tongji University, Shanghai, China. His research interests include formal method, Petri nets, services computing, and Workflow. He has published more than 100 papers in domestic and international academic journals and conference proceedings.