CN112860356A - API call control method and device, electronic equipment and storage medium - Google Patents

API call control method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112860356A
CN112860356A CN202110185114.8A CN202110185114A CN112860356A CN 112860356 A CN112860356 A CN 112860356A CN 202110185114 A CN202110185114 A CN 202110185114A CN 112860356 A CN112860356 A CN 112860356A
Authority
CN
China
Prior art keywords
called party
data
api
calling
party
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110185114.8A
Other languages
Chinese (zh)
Other versions
CN112860356B (en
Inventor
粘永
王明远
黄凤栗
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202110185114.8A priority Critical patent/CN112860356B/en
Publication of CN112860356A publication Critical patent/CN112860356A/en
Application granted granted Critical
Publication of CN112860356B publication Critical patent/CN112860356B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/425Lexical analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The application discloses an API call control method, an API call control device, electronic equipment, a medium and a computer program product, relates to the technical field of computers, and particularly relates to the technology of application program interfaces. The specific implementation scheme is as follows: responding to an API (application programming interface) calling request of a calling party, and determining a called party; determining a development state of the callee; according to the development state of the called party, feeding back true data or false data of the called party to the calling party for assisting the development of the calling party; the real data of the called party is generated according to the real running process of the called party; the dummy data is generated by simulating a running process of the called party. In the embodiment of the application, the real data and the false data are mixed and used in the software application development stage, so that the software development efficiency is improved.

Description

API call control method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a technique for an application program interface, and in particular, to a method and an apparatus for controlling API call, an electronic device, a storage medium, and a computer program product.
Background
In modern software engineering, both the scale of software, the variety of clients and infrastructure, and the speed of iteration in agile development have made traditional megalithic applications unfulfilled. Most software development teams will therefore employ the splitting of software into multiple subsystems. Under the design, each subsystem respectively plays its own role, and the functions of the personnel are gradually refined. The multiple subsystems are not required to be exposed to each other, and communication is often accomplished through an API (Application Programming Interface), wherein the API is a predefined function for providing the Application and developer with the ability to access a set of routines based on certain software or hardware, without accessing source code or understanding details of internal working mechanisms. With the development of project scale, the increase of the number and the capability of the system drives the rapid increase of the number of the API, so that the API management becomes an indispensable link in software engineering.
Disclosure of Invention
The application provides an API call control method, an API call control device, an electronic device, a storage medium and a computer program product.
According to an aspect of the present application, there is provided an API call control method including:
responding to an API (application programming interface) calling request of a calling party, and determining a called party;
determining the development state of a called party;
according to the development state of the called party, true data or false data of the called party is fed back to the calling party for assisting the development of the calling party;
the real data of the called party is generated according to the real running process of the called party; the dummy data is generated by simulating the running process of the called party.
According to another aspect of the present application, there is provided an API call control apparatus including:
the response module is used for responding to the API interface calling request of the calling party and determining the called party;
the development progress determining module is used for determining the development state of the called party;
the feedback module is used for feeding back real data or false data of the called party to the calling party according to the development state of the called party and assisting the development of the calling party;
the real data of the called party is generated according to the real running process of the called party; the dummy data is generated by simulating the running process of the called party.
According to another aspect of the present application, there is provided an electronic device including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the API call control method of any embodiment of the present application.
According to another aspect of the present application, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute an API call control method of any embodiment of the present application.
According to another aspect of the present application, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the API call control method of any of the embodiments of the present application
According to the technology of the application, true data and false data are mixed and used in the software application development stage, and the software development efficiency is improved.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present application, nor do they limit the scope of the present application. Other features of the present application will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not intended to limit the present application. Wherein:
FIG. 1a is a schematic diagram of an API management platform according to an embodiment of the application;
FIG. 1b is a diagram illustrating an API call control method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of an API call control method according to an embodiment of the application;
FIG. 3 is a schematic diagram of an API call control method according to an embodiment of the application;
FIG. 4 is a schematic diagram of an API call control apparatus according to an embodiment of the present application;
FIG. 5 is a block diagram of an electronic device for implementing a method of API call control according to an embodiment of the present application.
Detailed Description
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
In the embodiment of the application, a structural schematic diagram of an API management platform is shown in fig. 1a, where the API management platform includes a user interaction interface, an abstract syntax tree analysis service (Parser), a data processing service (seralizer), and a Reverse Proxy service (Reverse Proxy), a software application developer may edit API description data through an API Editor (API authoring tool) of the user interaction interface and send the API description data to the Parser for conversion of an abstract syntax tree, where the Parser includes a syntax tree transformation tool for multiple languages, for example, a JSON Parser for API description data written in a JSON language, and the converted abstract syntax tree is stored in a database DB; the data processing service Serializer can be used to retrieve an abstract syntax tree from a database and convert it into interface Code (Code) in a different language, a different type of file (e.g., DOC file), or dummy data (Mock) using a data processing tool. The BFF (Back For front end service developed For front end application) is used For receiving the API call request sent by the caller and forwarding the API call request to a Reverse Proxy service (Reverse Proxy), and the Reverse Proxy service determines the true data or false data to be fed back and sends the true data or false data to the caller through the BFF. On this basis, the API call control method according to the embodiment of the present application may be referred to in the following specific embodiments.
Fig. 1b is a flowchart illustrating an API call control method according to an embodiment of the present application, where the embodiment is applicable to a case where dummy data and true data are used in a mixed manner in a software development phase to assist development. The method can be executed by an API call control device, which is implemented in software and/or hardware and is integrated on an electronic device, for example on a server.
Specifically, referring to fig. 1b, the API call control method is as follows:
s101, responding to the API interface calling request of the calling party, and determining the called party.
In the embodiment of the application, in the software application development process, one function may need to be realized by mutually calling a plurality of micro services, for example, A, B, C three micro services are needed for realizing one function, and to realize the function, a micro service a needs to call a micro service B, the micro service B needs to call a micro service C, and the caller and the callee are opposite, for the micro services a and B, the micro service a is the caller, and the micro service B is the callee; and aiming at the micro service B and the micro service C, the micro service B is a calling party, and the micro service C is a called party. In the embodiment of the application, the API interface call request of the caller may optionally include an API interface name and an entry (e.g., ID), and further determines the callee by the API interface name and the entry, and by combining the API forwarding rule.
And S102, determining the development state of the called party.
And S103, feeding back real data or false data of the called party to the calling party according to the development state of the called party for assisting the development of the calling party.
The real data of the called party is generated according to the real running process of the called party; the dummy data is generated by simulating the running process of the called party.
In the implementation of the application, the dummy data is only selected by developers without help, and in order to ensure the development efficiency and ensure the quality of the application, the developers need to develop the dummy data as much as possible by adopting the true data. Because a calling party may need to call a plurality of services to realize one function, some called services may be developed and some called services may not be developed, the application uses the concept of mixed use of false data and true data in the development of software applications. Determining whether to feed back true data or false data to the caller needs to determine the development state of the callee, wherein the issuable state is the development progress of the callee, including undeveloped and developed. Therefore, if the called party service is developed, the true data is fed back to the calling party; and if the called party service is not developed, feeding back a false data calling party.
Further, the undeveloped completion status may be further subdivided into completion 1/3, completion 1/2, etc., according to the completion progress. Therefore, when the real data or the false data of the called party is fed back to the calling party, if the called party service only completes half of the development, the called party provides half of the real data, and feeds back half of the false data to the calling party so as to facilitate the development of the calling party.
In the embodiment of the application, the real data or the false data are fed back to the called party according to the development state of the called party, so that the real data and the false data are mixed for software application development, the software development efficiency is improved, the problems in the development process can be accurately found and modified due to the fact that the real data participates in the development, and the quality of the application development is further ensured.
Fig. 2 is a schematic flowchart of an API call control method according to an embodiment of the present application, where the embodiment is optimized based on the foregoing embodiment, and referring to fig. 2, the API call control method specifically includes the following steps:
s201, responding to the API interface calling request of the calling party, and determining the called party.
S202, obtaining flag bit data for identifying the development progress of the called party, and determining the development state of the called party according to the flag bit data.
In the embodiment of the application, in order to accurately and quickly determine the development state of the called party, a flag bit of the development progress of the called party is set in the API management platform to supervise the development progress of the called party, for example, a number 0 indicates that development is not completed, a data 1 indicates that development is completed, or a decimal between 0 and 1 may be used to indicate a specific completion condition, for example, a 0.5 indicates that development is completed by half. Therefore, when the development state is determined, the flag bit data for identifying the development progress of the called party can be directly acquired, and the development state of the called party is determined according to the flag bit data. It should be noted that, by using the flag bit data of the development progress, the efficiency and accuracy of determining the development state can be improved.
And S203, feeding back real data or false data to the calling party by adopting an API (application programming interface) provided by the called party according to the development state of the called party, and using the real data or the false data to assist the development of the calling party.
The API interface provided by the callee may include data such as a parameter type, an interface name, and a return value, and thus, true data or false data may be fed back to the caller through the API interface provided by the callee on the basis of determining the development state of the callee. It should be noted that the API interface provided by the called party
In an alternative embodiment, the feedback of true data or false data to the caller according to the development state of the callee by using the API interface provided by the callee includes: if the called party is developed, acquiring real data generated by the called party when the called party actually runs through the API, and feeding back the real data to the calling party; if the called party is not developed, acquiring and simulating the pseudo data generated by the called party in running through the API, and feeding back the pseudo data to the calling party, wherein the pseudo data generated in the running of the simulated called party is generated through a data processing service Serializer of the API management platform, and the required pseudo data is generated according to the interface data of the called party. In addition, when the called party is not developed, a part of true data can be fed back according to the real development progress of the called party, and the rest of true data is supplemented and fed back to the electrophoresis party by false data.
In the embodiment of the application, the efficiency and the accuracy of determining the development state can be improved through the flag bit data of the development progress; and the API interface provided by the called party is adopted to feed back true data or false data to the calling party according to the development state of the called party, so that the accuracy of feeding back data can be ensured, and the development efficiency is further ensured.
Fig. 3 is a schematic flowchart of an API call control method according to an embodiment of the present application, where the embodiment is optimized based on the foregoing embodiment, and referring to fig. 3, the API call control method specifically includes the following steps:
s301, responding to the API interface calling request of the calling party, and determining the called party according to the calling relation diagram.
The calling relational graph is a directed acyclic relational graph, nodes of the directed acyclic relational graph are calling parties or called parties, and directed edges of the directed acyclic relational graph define distribution rules of API interface calling requests. For example, the API name of the API interface call request of the caller is a path parameter, so that the API interface call request can be forwarded to the corresponding callee according to the difference between the allocation rule and the path, that is, the callee is determined, where the callee services corresponding to different paths are defined in the allocation rule. It should be noted here that, by calling the relationship diagram, not only the efficiency of determining the called party can be improved, but also the relationship between the services (i.e., the calling party or the called party) included in the whole software application is defined, which is convenient for later maintenance.
S302, determining the development state of the called party.
And S303, feeding back real data or false data to the calling party according to the development state of the called party by adopting an API (application programming interface) provided by the called party for assisting the development of the calling party, wherein the API provided by the called party is an abstract syntax tree which is stored in a database and corresponds to the called party.
In the embodiment of the application, the abstract syntax tree corresponding to the API interface is stored in the database, wherein the abstract syntax tree is a tree representation of an abstract syntax structure of the API interface description data. Each node on the tree represents a structure in the API interface description data, and each node has its own number in a predetermined order, for example, in the order of the syntax structure or the order of program execution.
In the embodiment of the application, the abstract syntax tree corresponding to the called party is obtained as follows:
receiving API interface description data sent by a called party; the API interface description data is converted into an abstract syntax tree and the abstract syntax tree is stored in a database. In an alternative embodiment, the process of converting the API interface description data into an abstract syntax tree comprises: performing lexical analysis on the API description data; parsing the syntax of the API interface description data subjected to lexical parsing to obtain a preprocessing code; and generating an abstract syntax tree corresponding to the API interface description data according to the preprocessing codes. It should be noted that the conversion of the API interface description data into the abstract syntax tree and the storage of the abstract syntax tree in the database is to enable the abstract syntax tree to be quickly converted into the data required by the caller according to any request from the caller. For example, in response to a conversion instruction of a caller, the abstract syntax tree corresponding to the caller is converted according to a code language type and/or a file type in the conversion instruction, and the abstract syntax tree may be converted into a DOC file, an interface code or other specified type of file. In addition, the abstract syntax tree is converted into abstract syntax tree storage, so that the interface and the resource are separated, and the same resource can be multiplexed by a plurality of interfaces.
Further, the API interface description data is generated according to any structured language, for example, the API interface description data may be generated by a structured language such as JSON, YAML, or ProtoBuf. Accordingly, in another alternative embodiment, converting the API interface description data into an abstract syntax tree comprises: determining a structured language for generating API description data; and converting the API description data into an abstract syntax tree by using a syntax tree analysis tool corresponding to the structured language. In the embodiment of the application, the API management platform provides multiple syntax tree analysis tools such as JSON Parser, YAML Parser and ProtoBuf Parser. Because the API description data can be generated by adopting a plurality of languages, the API description data is convenient for the API writers to use by different technical stack writers.
In the embodiment of the application, the calling relation graph is introduced, so that the efficiency of determining the called party can be improved, the relation among all services (namely the calling party or the called party) included in the whole software application is also defined, and the later maintenance is facilitated; the API description data generated by various languages can be converted into an abstract syntax tree, so that different technical stack writers can use the API description data conveniently; and the API description data is converted into an abstract syntax tree for storage, and can be quickly converted into the data required by the calling party according to any request of the calling party.
Fig. 4 is a schematic structural diagram of an API call control device according to an embodiment of the present application, where the embodiment is applicable to a case where dummy data and true data are mixed for auxiliary development in a software development stage. As shown in fig. 4, the apparatus specifically includes:
the response module 401 is configured to determine a called party in response to an API interface call request of the calling party;
a development progress determination module 402, configured to determine a development state of a callee;
a feedback module 403, configured to feed back true data or false data of the called party to the calling party according to the development state of the called party, so as to assist the calling party in development;
the real data of the called party is generated according to the real running process of the called party; the dummy data is generated by simulating the running process of the called party.
On the basis of the above embodiment, optionally, the development progress determining module is specifically configured to:
and acquiring flag bit data for identifying the development progress of the called party, and determining the development state of the called party according to the flag bit data.
On the basis of the foregoing embodiment, optionally, the feedback module includes:
and the feedback unit is used for feeding back real data or false data to the calling party by adopting an API (application programming interface) provided by the called party according to the development state of the called party.
On the basis of the above embodiment, optionally, the feedback unit is specifically configured to:
if the called party is developed, acquiring real data generated by the called party when the called party actually runs through the API, and feeding back the real data to the calling party;
and if the called party is not developed, acquiring and simulating the pseudo data generated during the operation of the called party through the API, and feeding back the pseudo data to the calling party.
On the basis of the foregoing embodiment, optionally, the response module includes:
the determining unit is used for determining the called party according to the calling relation graph; the calling relational graph is a directed acyclic relational graph, the nodes of the directed acyclic relational graph are calling parties or called parties, and the directed edges of the directed acyclic relational graph define the distribution rule of the API interface calling request.
On the basis of the above embodiment, optionally, the API interface provided by the callee is an abstract syntax tree stored in the database and corresponding to the callee;
the apparatus includes a syntax tree analysis module comprising:
the receiving unit is used for receiving API interface description data sent by a called party;
and the conversion unit is used for converting the API description data into the abstract syntax tree and storing the abstract syntax tree in the database.
On the basis of the above embodiment, optionally, the API interface description data is generated according to any one of structured languages;
correspondingly, the conversion unit is specifically configured to:
determining a structured language for generating API description data;
and converting the API description data into an abstract syntax tree by using a syntax tree analysis tool corresponding to the structured language.
On the basis of the above embodiment, optionally, the apparatus further includes:
and the conversion module is used for responding to the conversion instruction of the calling party and converting the abstract syntax tree corresponding to the calling party according to the code language type and/or the file type in the conversion instruction.
The API call control device provided by the embodiment of the application can execute the API call control method provided by any embodiment of the application, and has the corresponding functional module and beneficial effect of the execution method. Reference may be made to the description of any method embodiment of the present application for details not explicitly described in this embodiment.
There is also provided, in accordance with an embodiment of the present application, an electronic device, a readable storage medium, and a computer program product.
FIG. 5 illustrates a schematic block diagram of an example electronic device 500 that can be used to implement embodiments of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application that are described and/or claimed herein.
As shown in fig. 5, the apparatus 500 comprises a computing unit 501 which may perform various appropriate actions and processes in accordance with a computer program stored in a Read Only Memory (ROM)502 or a computer program loaded from a storage unit 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The calculation unit 501, the ROM 502, and the RAM 503 are connected to each other by a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
A number of components in the device 500 are connected to the I/O interface 505, including: an input unit 506 such as a keyboard, a mouse, or the like; an output unit 507 such as various types of displays, speakers, and the like; a storage unit 508, such as a magnetic disk, optical disk, or the like; and a communication unit 509 such as a network card, modem, wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information/data with other devices through a computer network such as the internet and/or various telecommunication networks.
The computing unit 501 may be a variety of general-purpose and/or special-purpose processing components having processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The calculation unit 501 executes the respective methods and processes described above, such as the API call control method. For example, in some embodiments, the API call control method may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 508. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 500 via the ROM 502 and/or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the computing unit 501, one or more steps of the API call control method described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to execute the API call control method in any other suitable manner (e.g., by way of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present application may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this application, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), blockchain networks, and the internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present application may be executed in parallel, sequentially, or in different orders, and the present invention is not limited thereto as long as the desired results of the technical solutions disclosed in the present application can be achieved.
The above-described embodiments should not be construed as limiting the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (19)

1. An API call control method, comprising:
responding to an API (application programming interface) calling request of a calling party, and determining a called party;
determining a development state of the callee;
according to the development state of the called party, feeding back true data or false data of the called party to the calling party for assisting the development of the calling party;
the real data of the called party is generated according to the real running process of the called party; the dummy data is generated by simulating a running process of the called party.
2. The method of claim 1, wherein determining the development status of the callee comprises:
and acquiring flag bit data for identifying the development progress of the called party, and determining the development state of the called party according to the flag bit data.
3. The method of claim 1, wherein feeding back true data or false data of the callee to the caller according to the development status of the callee comprises:
and feeding back true data or false data to the caller by adopting an API (application programming interface) provided by the callee according to the development state of the callee.
4. The method of claim 3, wherein feeding back true data or false data to the caller according to the development status of the callee using an API provided by the callee comprises:
if the called party is developed, acquiring real data generated by the called party when the called party actually runs through the API, and feeding the real data back to the calling party;
and if the called party is not developed, acquiring and simulating the pseudo data generated during the operation of the called party through the API, and feeding back the pseudo data to the calling party.
5. The method of claim 1, wherein determining a callee comprises:
determining a called party according to the calling relation graph; the calling relation graph is a directed acyclic relation graph, the nodes of the directed acyclic relation graph are calling parties or called parties, and directed edges of the directed acyclic relation graph define distribution rules of API interface calling requests.
6. The method of claim 3, the API interface provided by the callee being an abstract syntax tree stored in a database corresponding to the callee;
the abstract syntax tree corresponding to the called party is obtained by the following steps:
receiving API interface description data sent by the called party; converting the API interface description data into an abstract syntax tree and storing the abstract syntax tree in a database.
7. The method of claim 6, wherein the API interface description data is generated according to any one of structured languages;
correspondingly, the API interface description data is converted into an abstract syntax tree, including:
determining a structured language used for generating the API description data;
and converting the API description data into an abstract syntax tree by using a syntax tree analysis tool corresponding to the structured language.
8. The method of claim 6, further comprising:
and responding to a conversion instruction of a calling party, and converting the abstract syntax tree corresponding to the calling party according to the code language type and/or the file type in the conversion instruction.
9. An API call control apparatus comprising:
the response module is used for responding to the API interface calling request of the calling party and determining the called party;
the development progress determining module is used for determining the development state of the called party;
the feedback module is used for feeding back real data or false data of the called party to the calling party according to the development state of the called party and assisting the development of the calling party;
the real data of the called party is generated according to the real running process of the called party; the dummy data is generated by simulating a running process of the called party.
10. The apparatus of claim 9, wherein the development progress determination module is specifically configured to:
and acquiring flag bit data for identifying the development progress of the called party, and determining the development state of the called party according to the flag bit data.
11. The apparatus of claim 9, wherein the feedback module comprises:
and the feedback unit is used for feeding back real data or false data to the caller according to the development state of the callee by adopting an API (application programming interface) provided by the callee.
12. The apparatus according to claim 11, wherein the feedback unit is specifically configured to:
if the called party is developed, acquiring real data generated by the called party when the called party actually runs through the API, and feeding the real data back to the calling party;
and if the called party is not developed, acquiring and simulating the pseudo data generated during the operation of the called party through the API, and feeding back the pseudo data to the calling party.
13. The apparatus of claim 9, wherein the response module comprises:
the determining unit is used for determining the called party according to the calling relation graph; the calling relation graph is a directed acyclic relation graph, the nodes of the directed acyclic relation graph are calling parties or called parties, and directed edges of the directed acyclic relation graph define distribution rules of API interface calling requests.
14. The apparatus of claim 11, the API interface provided by the callee being an abstract syntax tree stored in a database corresponding to the callee;
the apparatus includes a syntax tree analysis module comprising:
a receiving unit, configured to receive API interface description data sent by the called party;
and the conversion unit is used for converting the API description data into an abstract syntax tree and storing the abstract syntax tree in a database.
15. The apparatus of claim 14, the API interface description data being generated according to any one of a structured language;
correspondingly, the conversion unit is specifically configured to:
determining a structured language used for generating the API description data;
and converting the API description data into an abstract syntax tree by using a syntax tree analysis tool corresponding to the structured language.
16. The apparatus of claim 14, further comprising:
and the conversion module is used for responding to a conversion instruction of a calling party and converting the abstract syntax tree corresponding to the calling party according to the code language type and/or the file type in the conversion instruction.
17. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-8.
18. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-8.
19. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1-8.
CN202110185114.8A 2021-02-10 2021-02-10 API call control method and device, electronic equipment and storage medium Active CN112860356B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110185114.8A CN112860356B (en) 2021-02-10 2021-02-10 API call control method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110185114.8A CN112860356B (en) 2021-02-10 2021-02-10 API call control method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112860356A true CN112860356A (en) 2021-05-28
CN112860356B CN112860356B (en) 2023-08-15

Family

ID=75989606

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110185114.8A Active CN112860356B (en) 2021-02-10 2021-02-10 API call control method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112860356B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113342353A (en) * 2021-07-01 2021-09-03 银联商务股份有限公司 Mock data generation method and device
CN115509514A (en) * 2022-11-23 2022-12-23 济南浪潮数据技术有限公司 Front-end data simulation method, device, equipment and medium
US11977906B1 (en) * 2020-11-06 2024-05-07 EJ2 Communications, Inc. Method for generating no-code automated cybersecurity tasks

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102739470A (en) * 2012-05-29 2012-10-17 百度在线网络技术(北京)有限公司 Method and device for realizing Hadoop system testing
WO2016107120A1 (en) * 2015-01-04 2016-07-07 华为技术有限公司 Application programming interface calling method and device
US20190205542A1 (en) * 2017-12-28 2019-07-04 Fmr Llc Automated secure software development management, risk assessment, and risk remediation
US20190325074A1 (en) * 2018-04-18 2019-10-24 International Business Machines Corporation Application programing interface document generator
CN110389751A (en) * 2019-07-17 2019-10-29 北京海致星图科技有限公司 A kind of data-interface mock method applied to knowledge mapping
CN110489101A (en) * 2019-07-15 2019-11-22 北京字节跳动网络技术有限公司 Interface analogy method, system, medium and electronic equipment
CN111124924A (en) * 2019-12-25 2020-05-08 五八同城信息技术有限公司 API (application program interface) deployment method and device, electronic equipment and storage medium
CN111159037A (en) * 2019-12-29 2020-05-15 北京车与车科技有限公司 API (application program interface) mock and agent testing method
CN111625224A (en) * 2020-05-28 2020-09-04 北京百度网讯科技有限公司 Code generation method, device, equipment and storage medium
CN111651366A (en) * 2020-07-06 2020-09-11 Oppo广东移动通信有限公司 SDK test method, device, equipment and storage medium
CN111857656A (en) * 2020-06-12 2020-10-30 北京百度网讯科技有限公司 Data processing method and device, electronic equipment and storage medium
CN112035282A (en) * 2020-09-01 2020-12-04 北京百度网讯科技有限公司 API management method, device, equipment and storage medium applied to cloud platform
CN112306881A (en) * 2020-11-02 2021-02-02 平安普惠企业管理有限公司 Simulation data generation method, device, equipment and storage medium

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102739470A (en) * 2012-05-29 2012-10-17 百度在线网络技术(北京)有限公司 Method and device for realizing Hadoop system testing
WO2016107120A1 (en) * 2015-01-04 2016-07-07 华为技术有限公司 Application programming interface calling method and device
US20190205542A1 (en) * 2017-12-28 2019-07-04 Fmr Llc Automated secure software development management, risk assessment, and risk remediation
US20190325074A1 (en) * 2018-04-18 2019-10-24 International Business Machines Corporation Application programing interface document generator
CN110489101A (en) * 2019-07-15 2019-11-22 北京字节跳动网络技术有限公司 Interface analogy method, system, medium and electronic equipment
CN110389751A (en) * 2019-07-17 2019-10-29 北京海致星图科技有限公司 A kind of data-interface mock method applied to knowledge mapping
CN111124924A (en) * 2019-12-25 2020-05-08 五八同城信息技术有限公司 API (application program interface) deployment method and device, electronic equipment and storage medium
CN111159037A (en) * 2019-12-29 2020-05-15 北京车与车科技有限公司 API (application program interface) mock and agent testing method
CN111625224A (en) * 2020-05-28 2020-09-04 北京百度网讯科技有限公司 Code generation method, device, equipment and storage medium
CN111857656A (en) * 2020-06-12 2020-10-30 北京百度网讯科技有限公司 Data processing method and device, electronic equipment and storage medium
CN111651366A (en) * 2020-07-06 2020-09-11 Oppo广东移动通信有限公司 SDK test method, device, equipment and storage medium
CN112035282A (en) * 2020-09-01 2020-12-04 北京百度网讯科技有限公司 API management method, device, equipment and storage medium applied to cloud platform
CN112306881A (en) * 2020-11-02 2021-02-02 平安普惠企业管理有限公司 Simulation data generation method, device, equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李晓静;彭春燕;田青;: "基于构件组装的信息处理软件开发方法", 计算机技术与发展, no. 11, pages 134 - 136 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11977906B1 (en) * 2020-11-06 2024-05-07 EJ2 Communications, Inc. Method for generating no-code automated cybersecurity tasks
CN113342353A (en) * 2021-07-01 2021-09-03 银联商务股份有限公司 Mock data generation method and device
CN113342353B (en) * 2021-07-01 2023-05-23 银联商务股份有限公司 Mock data generation method and device
CN115509514A (en) * 2022-11-23 2022-12-23 济南浪潮数据技术有限公司 Front-end data simulation method, device, equipment and medium
CN115509514B (en) * 2022-11-23 2023-03-10 济南浪潮数据技术有限公司 Front-end data simulation method, device, equipment and medium

Also Published As

Publication number Publication date
CN112860356B (en) 2023-08-15

Similar Documents

Publication Publication Date Title
CN112860356B (en) API call control method and device, electronic equipment and storage medium
CN113342345A (en) Operator fusion method and device of deep learning framework
CN110780879B (en) Decision execution method, device, equipment and medium based on intelligent compiling technology
CN115509522A (en) Interface arranging method and system for low-code scene and electronic equipment
CN113760769A (en) Test case processing method and device, electronic equipment and storage medium
EP4075263A1 (en) Dependency graph generation method and apparatus, device, storage medium, and program product
CN112989797B (en) Model training and text expansion methods, devices, equipment and storage medium
CN116302218B (en) Function information adding method, device, equipment and storage medium
CN113127357A (en) Unit testing method, device, equipment, storage medium and program product
CN113778849A (en) Method, apparatus, device and storage medium for testing code
CN115905322A (en) Service processing method and device, electronic equipment and storage medium
CN113691403A (en) Topological node configuration method, related device and computer program product
CN113642295A (en) Page layout method, page layout device and computer program product
CN114218313A (en) Data management method, device, electronic equipment, storage medium and product
CN114417070A (en) Method, device and equipment for converging data authority and storage medium
CN113360672A (en) Methods, apparatus, devices, media and products for generating a knowledge graph
CN113138760A (en) Page generation method and device, electronic equipment and medium
CN112947941A (en) Method and device for adding exception handling code
CN111078230A (en) Code generation method and device
CN116431108B (en) Object type processing method and device, electronic equipment and storage medium
CN117270838B (en) Method, device, equipment and medium for generating universal formula script
JP7393404B2 (en) Compiling method, compiling device, electronic device, storage medium and program
CN117270862A (en) Software pluggable method, device, equipment and medium based on dynamic compiling
CN115237420A (en) Code generation method and device, electronic equipment and computer readable storage medium
CN114115854A (en) SDK file generation method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant