Interface call processing method and device based on developer extended scenario
By obtaining and verifying the interface request parameters and partner call tracking chain in the interface call processing, the problem of insufficient fine-grained interface call data acquisition in the existing technology is solved, interface call analysis and exception positioning are realized, and system debugging and maintenance efficiency is improved.
Patent Information
- Application Number
- CN202111584680.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-22
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2041-12-22
AI Technical Summary
In the prior art, it is difficult to collect fine-grained interface call scenario data during interface call, resulting in the inability to effectively analyze the data presentation of the interface to different callers and quickly locate problem points.
By obtaining interface request parameters and authorizing the partner to call the tracking chain, verifying the partner information and the interface call tracking chain, performing interface calls and storing the call records, including interface, request parameters and verification results.
It realizes more fine-grained collection of interface call scenario data, supports interface call analysis and exception positioning, and improves system debugging and maintenance efficiency.
Smart Images

Figure CN114490113B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an interface call processing method, device, electronic device and computer-readable storage medium based on a developer-extended scenario. Background Art
[0002] In the prior art, the call of the Internet underlying capability interface provided by the communication system has the characteristics of hierarchical call. For example, the communication system of the headquarters provides the Internet underlying capability interface for the telecom partners in the mid-level provinces to apply for and call. Furthermore, the telecom partners in the mid-level provinces can further encapsulate the applied Internet underlying capability interface for the telecom partners in the districts and cities in the province to call. In the actual calling process, for a single interface, the mid-level provinces can only collect the total call volume and overall error code statistics of the next-level partners for the interface, which is not conducive to analyzing the data performance presented by the interface to different callers; on the other hand, when the interface call volume is abnormal and causes resource alarms, it is impossible to quickly locate the problem point from multiple call sources.
[0003] Based on the above problems, it is necessary to provide an interface call processing method based on developer-extended scenarios to provide more fine-grained interface call scenario data for interface call analysis and exception location. Summary of the invention
[0004] The embodiment of the present application provides an interface call processing method based on developer-extended scenarios, which helps to collect more fine-grained interface call scenario data.
[0005] In a first aspect, an embodiment of the present application provides an interface call processing method based on a developer extension scenario, including:
[0006] In response to calling the current functional interface, obtaining interface request parameters matched by the call, and obtaining a call tracking chain of an authorized partner pre-configured for the current functional interface;
[0007] Based on the authorized partner call tracking chain, verify the partner information and the interface call tracking chain carried in the interface request parameters;
[0008] In response to the interface request parameter verification being successful, executing the current functional interface based on the interface request parameter;
[0009] In response to the interface request parameter verification failing, intercepting the call;
[0010] The call record of the current functional interface is stored, wherein the call record carries one or more of the following information: the current functional interface, the interface request parameters, and the result of verifying the interface request parameters.
[0011] In a second aspect, an embodiment of the present application provides an interface call processing device based on a developer extension scenario, including:
[0012] An interface request parameter and configuration data acquisition module, used to respond to a call to a current functional interface, acquire the interface request parameters matched by the call, and acquire a call tracking chain of an authorized partner pre-configured for the current functional interface;
[0013] An interface request parameter verification module, used to verify the partner information and the interface call tracking chain carried in the interface request parameters based on the authorized partner call tracking chain;
[0014] A function interface call processing module, configured to execute the current function interface based on the interface request parameters in response to successful verification of the interface request parameters;
[0015] The functional interface call processing module is further used to intercept the call in response to the interface request parameter verification failure;
[0016] The call record storage module is used to store the call record of the current functional interface, and the call record carries one or more of the following information: the current functional interface, the interface request parameters, and the result of verifying the interface request parameters.
[0017] In the third aspect, an embodiment of the present application also discloses an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the interface call processing method based on the developer's extended scenario described in the embodiment of the present application is implemented.
[0018] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the steps of the interface call processing method based on the developer's extended scenario disclosed in an embodiment of the present application.
[0019] The interface call processing method based on the developer's extended scenario disclosed in the embodiment of the present application obtains the interface request parameters matching the call in response to the call of the current functional interface, and obtains the authorized partner call tracking chain pre-configured for the current functional interface; based on the authorized partner call tracking chain, verifies the partner information carried in the interface request parameters and the interface call tracking chain; in response to the successful verification of the interface request parameters, executes the current functional interface based on the interface request parameters; in response to the failure of the interface request parameter verification, intercepts the call; stores the call record of the current functional interface, the call record carries one or more of the following information: the current functional interface, the interface request parameters, and the result of verifying the interface request parameters, which helps to collect more fine-grained interface call scenario data, such as call link data.
[0020] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0022] Figure 1 This is a flow chart of an interface call processing method based on a developer extension scenario in Example 1 of the present application;
[0023] Figure 2 This is another flow chart of the interface call processing method based on the developer extension scenario of the first embodiment of the present application;
[0024] Figure 3 This is a schematic diagram of the partner authorization call tracking chain of the first embodiment of the present application;
[0025] Figure 4 This is one of the structural diagrams of the interface call processing device based on the developer extension scenario of the second embodiment of the present application;
[0026] Figure 5 This is the second structural diagram of the interface call processing device based on the developer extension scenario of the second embodiment of the present application;
[0027] Figure 6A block diagram schematically shows an electronic device for executing the method according to the present application; and
[0028] Figure 7 A storage unit for holding or carrying a program code for implementing the method according to the present application is schematically shown. DETAILED DESCRIPTION
[0029] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0030] Embodiment 1
[0031] The embodiment of the present application discloses an interface call processing method based on a developer extension scenario, such as Figure 1 As shown, the method includes: steps 110 to 150.
[0032] Step 110, in response to the call to the current functional interface, obtain the interface request parameters matched by the call, and obtain the authorized partner call tracking chain pre-configured for the current functional interface.
[0033] The developer extension scenario described in the embodiment of this application indicates that the original service capability is packaged by the interface caller itself or indirectly provided to a third party. Taking the telecommunications system as an example, the number query interface capability of the underlying omni-channel Internet card is provided to various partners when the number query capability is provided in the province after applying for the interface in a certain province. Different partners will continue to develop their own business and provide the number query capability obtained from the provincial level.
[0034] In the embodiment of the present application, in order to track the function interface calls of the developer's extended scenario, the function interface provided to the operator for calling is firstly standardized and modified, and a call monitoring code is set in the function interface. Figure 2 As shown, before the step of obtaining the interface request parameters matching the call in response to the call to the current functional interface and obtaining the authorized partner call tracking chain pre-configured for the current functional interface, it also includes: step 100 to step 103.
[0035] Step 100: Acquire the functional interface in the business protocol, and standardize the interface code and interface request parameters of the functional interface.
[0036] Taking the communication service business as an example, we first count the functional interfaces in the service protocols provided in the system, and then further standardize the interface code and interface request parameters of each functional interface.
[0037] The standardization of the interface code of each functional interface includes: digitizing the functional interface to obtain the interface code of each functional interface, encoding the same functional interface in the form of the same prefix, and the like.
[0038] Standardization of interface request parameters includes: standardizing the definition of interface request parameters, adding interface indirect provision identifiers to interface request parameters, and adding call permission parameters to interface request parameters. Among them, the interface indirect provision identifier is used to indicate that the caller directly uses the interface and will not encapsulate or indirectly provide the interface to the outside world; the call permission parameters include: the caller's partner code and the caller's interface call tracking chain. By setting the interface indirect provision identifier, clear specifications for the indirect provision of interface capabilities are proposed.
[0039] Step 101: store the authorized partner call tracking chain of each functional interface according to the pre-configured authorized call relationship between the partner and the functional interface.
[0040] Next, the business system further determines whether there is data management of partners related to the business agreement and the functional interfaces they apply for in the system, for example, whether there is a partner authorization call tracking link that stores the development and extension relationship of partners authorized to call each functional interface. After determining that there is no data management of partners related to the business agreement and the functional interfaces they apply for in the business system, the business system further generates an authorization call relationship between the partner and the functional interface based on the configuration information, and stores the authorization call relationship as a binary tree structure.
[0041] In some embodiments of the present application, a binary tree structure is defined for storing the authorized partner call tracking chain. The authorized partner call tracking chain is stored in a binary tree structure, and the root node of the binary tree structure corresponds to the original function interface provider; the right child node in the binary tree is an extension node, and the extension node corresponds to the partner developed by the parent node of the right child node; the left child node in the binary tree is a non-extended node, and the non-extended node corresponds to the partner at the same level as the parent node of the left child node. Figure 3As shown, taking the telecommunications group corresponding to node A1 as an example, the left child nodes A2, A3, ... A5 of the root node A1 can respectively correspond to the authorization management departments that handle different mid-level provinces within the group; the right child nodes B1 and B2 of the root node A1 are the same authorized partners of the designated functional interface under the telecommunications group (for example: B1 and B2 are nodes corresponding to different channels of authorized partner Y). Further, taking node A2 as the node corresponding to the authorization management department of province X as an example, node C1 corresponds to the node corresponding to authorized partner 1 of the designated functional interface in province X, node C2 corresponds to the node corresponding to authorized partner 2 of the designated functional interface in province X, and node C3 corresponds to the node corresponding to authorized partner 3 of the designated functional interface in province X. Nodes C1, C2, and C3 are nodes of the same source data, and the superior partners of nodes C1, C2, and C3 that are nodes of the same source data are all telecommunications groups (i.e., the original functional interface provider corresponding to the root node A1). Furthermore, node H1 is the right child node of node C1, which may correspond to the node corresponding to the partner developed by authorized partner 1 in province X; node L1 is the right child node of node C2, which may correspond to the node corresponding to the partner developed by authorized partner 2 in province X.
[0042] In some embodiments of the present application, each node of the binary tree may further store data such as the code of the corresponding partner, the interface code of the functional interface authorized to be called by the partner, and the interface call tracking chain of the partner. The partner code is a unique identifier of each partner in the business system generated by the business system according to preset rules, and the interface call tracking chain is a digital expression of the hierarchical authorization call relationship of the partner to the specified functional interface obtained by the business system after traversing the above binary tree. For example, the interface call tracking chain can be represented by a string consisting of the interface code of the functional interface and the codes of the partners developed layer by layer from the telecommunications group to the current partner.
[0043] Combination Figure 3 As can be inferred from the above description, the authorized partner call tracking chain stored in the binary tree structure carries the partner information, the authorized call information of the specified functional interface, and the development and extension relationship of the partner.
[0044] In some embodiments of the present application, before obtaining the authorized partner call tracking chain pre-configured for the current functional interface, the steps include: in response to obtaining a call permission request for a preset functional interface, obtaining a partner that matches the call permission request, and developing a superior partner of the partner; determining whether the superior partner has extended call permissions for the preset functional interface based on the authorized partner call tracking chain pre-configured for the preset functional interface; in response to the superior partner having extended call permissions for the preset functional interface, generating a partner code for the partner and an interface call tracking chain that authorizes the partner to call the preset functional interface; and incrementally storing the correspondence between the generated partner code and the interface call tracking chain in the authorized partner call tracking chain.
[0045] In some embodiments of the present application, the partner can submit the functional interface to be called, the information of the superior partner, and whether to directly call the functional interface to be called, or whether there is a need to provide the functional interface to a third party through an online application. The business system authorizes the partner to call the interface according to the request of the partner, and stores the storage information in the authorized partner call tracking chain of the aforementioned binary tree structure. For example, partner 1 inputs its own information and superior partner information through the client of the business system, selects the functional interface to be called, sets whether there is a need to provide the functional interface to a third party (i.e., whether to open the extended call permission), and then submits the call permission request. After the business system obtains the call permission request submitted by partner 1, it obtains the partner's own information, superior partner information, and selected functional interface input by partner 1, and further obtains the established authorized partner call tracking chain of the selected functional interface. Next, the business system determines whether the superior partner input by the partner has the extended call permission of the functional interface based on the data in the established authorized partner call tracking chain.
[0046] Among them, the extended calling authority is set by each partner when applying for the calling authority of the functional interface. In some embodiments of the present application, each node of the authorized partner calling tracking chain stores the interface providing identifier of the corresponding partner, which is used to indicate whether the partner provides the preset functional interface to the developed partner; the authorized partner calling tracking chain pre-configured based on the preset functional interface determines whether the superior partner has the extended calling authority of the preset functional interface, including: traversing each node in the authorized partner calling tracking chain to obtain the node corresponding to the superior partner; according to the interface providing identifier stored in the node corresponding to the superior partner, determine whether the superior partner has the extended calling authority of the preset functional interface. As described above, each node in the authorized partner calling tracking chain corresponds to a partner authorized to use the functional interface, and each node stores the partner code of the corresponding partner, the functional interface code authorized to be called, the interface calling tracking chain, and whether the functional interface is provided to the interface providing identifier for a third party to call. Therefore, by traversing each node data in the authorized partner call tracking chain, the node in the authorized partner call tracking chain corresponding to the upper-level partner input by partner 1 can be determined, and the interface provided identifier stored in the node can be further obtained. Then, according to the interface provided identifier, it is determined whether the upper-level partner input by partner 1 is authorized to authorize other partners to call the functional interface.
[0047] If the business system determines that the superior partner input by partner 1 has the extended calling authority of the functional interface (i.e., the superior partner is authorized to authorize other partners to call the functional interface), it further generates a partner code for partner 1 and generates an interface call tracking chain for authorizing partner 1 to call the functional interface. Afterwards, the business system adds the corresponding relationship between the generated partner code of partner 1 and the interface call tracking chain to the authorized partner call tracking chain.
[0048] In some embodiments of the present application, the partner's interface call tracking chain can be represented by a string generated by sequentially connecting the partner codes of the partners at each level according to the hierarchical development relationship of the partners. In other embodiments of the present application, the partner's interface call tracking chain can also be represented by a string generated by sequentially connecting the node identifiers corresponding to the partners at each level according to the hierarchical development relationship of the partners. In still other embodiments of the present application, the partner's interface call tracking chain can also be generated in other ways according to the hierarchical development relationship of the partners, which will not be listed one by one in the embodiments of the present application.
[0049] In some embodiments of the present application, the length of the interface call tracking chain may also be set, that is, the level of partner development extension may be set.
[0050] In some embodiments of the present application, the correspondence between the generated partner code and the interface call tracking chain is incrementally stored in the authorized partner call tracking chain, including: traversing each node in the authorized partner call tracking chain to obtain the node corresponding to the superior partner; establishing a right child node of the node corresponding to the superior partner, and storing the matching relationship between the generated partner code and the interface call tracking chain in the established right child node. For example, first find the node corresponding to the superior partner input by partner 1 in the authorized partner call tracking chain, and add the right child node of the node, then store the partner code of partner 1, the interface code of the functional interface applied for calling, the interface call tracking chain generated by the business system for partner 1 and other data in the right child node.
[0051] Step 102: adding a calling authority parameter to the interface request parameters of each of the functional interfaces, wherein the calling authority parameter includes: a partner code and an interface calling tracking chain.
[0052] Furthermore, the business system improves each functional interface of the business protocol by designing interface service calling rules, and adds the parent partner code of the current caller and the interface call tracking chain of the current caller as two required input interface request parameters in the interface request parameters of the functional interface.
[0053] Step 103, setting the call source data monitoring of the functional interface, wherein the call source data monitoring is used to respond to the call of the functional interface and perform monitoring processing of the call source data based on the interface request parameters.
[0054] In some embodiments of the present application, the business system also sets up call source data monitoring for each functional interface. For example, by inserting callback functions into each functional interface to monitor the call events of the functional interface, it is possible to monitor the call compliance of the functional interface, analyze the call links and call results of the functional interface, etc. In other embodiments of the present application, the call source data monitoring of the functional interface can also be set up in other ways, which will not be listed one by one in the embodiments of the present application.
[0055] In some embodiments of the present application, the business system may further set up an exception handling module for the functional interface, which is used to perform abnormal condition analysis on the call records of the recorded functional interfaces, and when it is determined that a call exception exists in a certain functional interface, further determine the partner where the abnormal call occurs based on the call record of the functional interface and the interface call tracking chain.
[0056] Step 120: Based on the authorized partner call tracking chain, verify the partner information and the interface call tracking chain carried in the interface request parameters.
[0057] The verification includes: interface call standardization verification and / or call permission verification.
[0058] As mentioned above, the business system will update the authorized partner call tracking chain corresponding to each functional interface in real time based on the partner's application.
[0059] Next, during the operation of the business system, when the functional interface is called, the interface request parameters of the current call and the authorized partner call tracking chain of the currently called functional interface can be obtained through the pre-set call source data monitoring. Further, the interface request parameters are verified according to the partner code, interface call tracking chain and other data stored in each node in the authorized partner call tracking chain.
[0060] In some embodiments of the present application, the following information stored in the authorized partner call tracking chain is obtained: the development extension relationship of each partner who has been authorized to call the current functional interface, and the interface call tracking chain of each partner; based on the authorized partner call tracking chain, the partner information carried in the interface request parameters and the interface call tracking chain are verified, including: determining the matching relationship between the partner information carried in the interface request parameters and the interface call tracking chain, and whether they match the development extension relationship of the partner who has been authorized to call the current functional interface, and the interface call tracking chain stored in the authorized partner call tracking chain; wherein the partner information carried in the interface request parameters indicates the upper limit of the caller For a level partner, the interface call tracking chain carried in the interface request parameters represents the interface call tracking chain of the caller; in response to the matching relationship between the partner information carried in the interface request parameters and the interface call tracking chain, the development and extension relationship with the partner who has been authorized to call the current functional interface, and the interface call tracking chain stored in the authorized partner call tracking chain matches, and it is determined that the interface request parameter verification is successful; in response to the matching relationship between the partner information carried in the interface request parameters and the interface call tracking chain, the development and extension relationship with the partner who has been authorized to call the current functional interface, and the interface call tracking chain stored in the authorized partner call tracking chain do not match, and it is determined that the interface request parameter verification has failed.
[0061] In some embodiments of the present application, when performing an interface call compliance check on a call to a certain functional interface, first verify whether the interface request parameters contain two calling permission parameters, namely, the superior partner code of the partner calling the current functional interface and the interface call tracking chain of the partner, and determine whether the format of these two calling permission parameters meets the requirements of the interface specification.
[0062] After the interface call normative verification is successful, the partner hierarchical development relationship expressed by the call permission parameters and the legitimacy of the content of the interface call tracking chain are further verified. For example, first determine whether the current caller's superior partner is an authorized calling partner of the functional interface based on the superior partner code of the current caller. If the superior partner of the current caller is not an authorized calling partner of the functional interface, it can be directly determined that the superior partner code and the partner's interface call tracking chain do not match the partner who is authorized to call the current functional interface and the development extension relationship of the partner.
[0063] After determining that the superior partner of the current caller is the authorized calling partner of the functional interface, further determine whether the interface call tracking chain of the current caller is the call tracking chain of the partner developed by the superior partner of the current caller. If so, determine that the superior partner code and the interface call tracking chain of the partner match the development and extension relationship between the partner authorized to call the current functional interface and the partner; otherwise, determine that the superior partner code and the interface call tracking chain of the partner do not match the development and extension relationship between the partner authorized to call the current functional interface and the partner.
[0064] As mentioned above, the authorized partner call tracking chain is stored in a binary tree structure, and the root node of the binary tree structure corresponds to the original function interface provider; the right child node in the binary tree is an extended node, and the extended node corresponds to the partner developed by the parent node of the right child node; the left child node in the binary tree is a non-extended node, and the non-extended node corresponds to the partner at the same level as the parent node of the left child node.
[0065] In some embodiments of the present application, the determination of the matching relationship between the partner information carried in the interface request parameters and the interface call tracking chain, and the development extension relationship with the partner authorized to call the current functional interface, and the interface call tracking chain stored in the authorized partner call tracking chain, include: traversing the authorized partner call tracking chain stored in a binary tree structure, and obtaining the left child node or the right child node corresponding to the partner information carried in the interface request parameters as a node to be matched; according to the development extension relationship of the partner authorized to call the current functional interface stored in the binary tree structure, obtaining the interface call tracking chain of the right child node of the node to be matched as a node to be matched. Matching an interface call tracking chain; comparing the interface call tracking chain carried in the interface request parameters with the interface call tracking chain to be matched; in response to a successful comparison, determining that the matching relationship between the partner information carried in the interface request parameters and the interface call tracking chain matches the development and extension relationship of the partner who has been authorized to call the current functional interface, and the interface call tracking chain stored in the authorized partner call tracking chain; in response to a failed comparison, determining that the matching relationship between the partner information carried in the interface request parameters and the interface call tracking chain does not match the development and extension relationship of the partner who has been authorized to call the current functional interface, and the interface call tracking chain stored in the authorized partner call tracking chain.
[0066] For example, by traversing the partner codes stored in each node in the authorized partner call tracking chain, search for the node storing the upper partner code of the current caller (such as the node corresponding to the partner indicated by the partner information carried in the interface request parameter) as the node to be matched. Then, further obtain the right child node of the node to be matched, that is, the interface call tracking chain stored in the extended node of each node to be matched, as the interface call tracking chain to be matched. After that, the interface call tracking chain carried in the interface request parameter is compared with each of the interface call tracking chains to be matched. If the interface call tracking chain carried in the interface request parameter is successfully compared with a certain interface call tracking chain to be matched, it can be considered that the current caller of the functional interface is a partner developed by the upper partner. That is, the development extension relationship between the partner carried in the interface request parameter and the caller of the current functional interface is included in the development extension relationship of the partner who has been authorized to call the current functional interface, and the interface call tracking chain carried in the interface request parameter is the interface call tracking chain of the developer of a partner in the call tracking chain.
[0067] On the contrary, if the partner codes stored in each node in the authorized partner call tracking chain are traversed, and no node corresponding to the partner information carried in the interface request parameter is found, it can be considered that the partner and interface call tracking chain carried in the interface request parameter do not match the development extension relationship and interface call tracking chain of the partner who has been authorized to call the current functional interface. If the interface call tracking chain and the interface call tracking chain carried in the interface request parameter fail to match all the interface call tracking chains to be matched, it can be considered that the current caller of the functional interface is not a partner developed by the designated superior partner, that is, the superior partner code and the partner's interface call tracking chain do not match the partner who has been authorized to call the current functional interface and the partner's development extension relationship.
[0068] Step 130: In response to the interface request parameter verification being successful, executing the current functional interface based on the interface request parameter.
[0069] If the result of verifying the interface request parameters is that the verification is successful, the currently called functional interface will continue to be executed to provide services to the caller.
[0070] Step 140: In response to the interface request parameter verification failing, intercept the call.
[0071] If the result of verifying the interface request parameters is a verification failure, such as an irregular interface call or a call to an unauthorized function interface, the current call to the function will be intercepted and no service will be provided to the caller.
[0072] Step 150: store the call record of the current functional interface, wherein the call record carries one or more of the following information: the current functional interface, the interface request parameters, and the result of verifying the interface request parameters.
[0073] For each call to a functional interface, the business system can store the corresponding call record to record information such as the time when each functional interface is called, interface request parameters, verification results, and call results.
[0074] For the stored call records, since the interface request parameters include: the caller's superior partner information and interface call tracking chain information, the call volume and call results of each partner for different functional structures can be further analyzed based on the call data.
[0075] The interface call processing method based on the developer's extended scenario disclosed in the embodiment of the present application obtains the interface request parameters matching the call in response to the call of the current functional interface, and obtains the authorized partner call tracking chain pre-configured for the current functional interface; based on the authorized partner call tracking chain, verifies the partner information carried in the interface request parameters and the interface call tracking chain; in response to the successful verification of the interface request parameters, executes the current functional interface based on the interface request parameters; in response to the failure of the interface request parameter verification, intercepts the call; stores the call record of the current functional interface, the call record carries one or more of the following information: the current functional interface, the interface request parameters, and the result of verifying the interface request parameters, which helps to collect more fine-grained interface call scenario data, such as call link data.
[0076] The interface call processing method based on the developer extension scenario disclosed in the embodiment of the present application establishes a call tracking chain to store the partner development extension relationship of each functional interface and the partner's interface call tracking chain, and verifies the call link and the development extension relationship during the process of the functional interface being called, so that the functional interface call analysis data with more granularity and dimensions can be obtained based on the stored call records. For example, functional interface call data based on the partner dimension and call data based on the functional interface dimension are obtained.
[0077] On the other hand, by adding the information of the superior partner and the interface call tracking chain of the current caller to the input parameters of the functional interface, and setting up call source data monitoring to verify the interface request parameters when the functional interface is called, not only can the accurate call link of the functional interface be recorded, but also when an exception occurs in the call, the partner who called the functional interface and the interface request parameters can be accurately located, and the exception data can be output to the exception data processing system for exception analysis, which helps to improve the maintenance efficiency of the business system.
[0078] Furthermore, by pre-standardizing the functional interface and checking the interface request parameters when the functional interface is called, it helps to promote the standardization of the functional interface.
[0079] Embodiment 2
[0080] The embodiment of the present application discloses an interface call processing device based on a developer extension scenario, such as Figure 4 As shown, the device comprises:
[0081] The interface request parameter and configuration data acquisition module 410 is used to obtain the interface request parameters matched by the call in response to the call of the current functional interface, and to obtain the authorized partner call tracking chain pre-configured for the current functional interface;
[0082] The interface request parameter verification module 420 is used to verify the partner information and the interface call tracking chain carried in the interface request parameters based on the authorized partner call tracking chain;
[0083] A function interface call processing module 430 is used to execute the current function interface based on the interface request parameters in response to the interface request parameter verification being successful;
[0084] The functional interface call processing module 430 is further used to intercept the call in response to the interface request parameter verification failure;
[0085] The call record storage module 440 is used to store the call record of the current functional interface, and the call record carries one or more of the following information: the current functional interface, the interface request parameters, and the result of verifying the interface request parameters.
[0086] In some embodiments of the present application, the following information stored in the authorized partner call tracking chain is obtained: the development extension relationship of the partner authorized to call the current functional interface, and the partner's interface call tracking chain; the interface request parameter verification module 420 is further used to:
[0087] Determine whether the matching relationship between the partner information carried in the interface request parameter and the interface call tracking chain, the development extension relationship with the partner authorized to call the current functional interface, and the interface call tracking chain stored in the authorized partner call tracking chain match;
[0088] The interface request parameter verification module 420 is further used to respond to the matching relationship between the partner information carried in the interface request parameter and the interface call tracking chain, the development extension relationship with the partner authorized to call the current functional interface, and the interface call tracking chain stored in the authorized partner call tracking chain, and determine that the interface request parameter verification is successful; and,
[0089] In response to the matching relationship between the partner information carried in the interface request parameters and the interface call tracking chain, the development and extension relationship with the partner who has been authorized to call the current functional interface, and the mismatch between the interface call tracking chain stored in the authorized partner call tracking chain, it is determined that the interface request parameter verification has failed.
[0090] In some embodiments of the present application, the authorized partner call tracking chain is stored in a binary tree structure, the root node of the binary tree structure corresponds to the original function interface provider; the right child node in the binary tree is an extension node, and the extension node corresponds to the partner developed by the parent node of the right child node; the left child node in the binary tree is a non-extended node, and the non-extended node corresponds to the partner at the same level as the parent node of the left child node; the determination of the matching relationship between the partner information carried in the interface request parameter and the interface call tracking chain, the development extension relationship with the partner authorized to call the current function interface, and whether the interface call tracking chain stored in the authorized partner call tracking chain matches includes:
[0091] By traversing the authorized partner call tracking chain stored in a binary tree structure, a left child node or a right child node corresponding to the partner information carried in the interface request parameter is obtained as a node to be matched;
[0092] According to the development extension relationship of the partners who are authorized to call the current functional interface stored in the binary tree structure, the interface call tracking chain of the right child node of the node to be matched is obtained as the interface call tracking chain to be matched;
[0093] Compare the interface call tracking chain carried in the interface request parameter with the interface call tracking chain to be matched;
[0094] In response to the comparison being successful, determining a matching relationship between the partner information carried in the interface request parameter and the interface call tracking chain, a development extension relationship with the partner authorized to call the current functional interface, and an interface call tracking chain stored in the authorized partner call tracking chain;
[0095] In response to the comparison failure, determining the matching relationship between the partner information carried in the interface request parameters and the interface call tracking chain, the development extension relationship with the partner authorized to call the current functional interface, and the interface call tracking chain stored in the authorized partner call tracking chain do not match.
[0096] In some embodiments of the present application, Figure 5 As shown, the device comprises:
[0097] The call tracking chain establishment module 408 is used to obtain a partner matching the call permission request in response to obtaining a call permission request of a preset function interface, and to develop a superior partner of the partner;
[0098] The call tracking chain establishing module 408 is further used to determine whether the superior partner has the extended call permission of the preset function interface based on the authorized partner call tracking chain pre-configured for the preset function interface; and in response to the superior partner having the extended call permission of the preset function interface, generate the partner code of the partner and the interface call tracking chain authorizing the partner to call the preset function interface;
[0099] The call tracking chain establishing module 408 is further used to incrementally store the corresponding relationship between the generated partner code and the interface call tracking chain in the authorized partner call tracking chain.
[0100] In some embodiments of the present application, the authorized partner call tracking chain is stored in a binary tree structure, and the root node of the binary tree structure corresponds to the original function interface provider; the right child node in the binary tree is an extended node, and the extended node corresponds to the partner developed by the parent node of the right child node; the left child node in the binary tree is a non-extended node, and the non-extended node corresponds to the partner at the same level as the parent node of the left child node; each node of the authorized partner call tracking chain stores an interface provision identifier of the corresponding partner, which is used to indicate whether the partner provides the preset function interface to the developed partner; the authorized partner call tracking chain pre-configured based on the preset function interface determines whether the upper-level partner has the extended call authority of the preset function interface, including:
[0101] Traverse each node in the authorized partner call tracking chain to obtain the node corresponding to the upper-level partner;
[0102] According to the interface provision identifier stored in the node corresponding to the upper-level partner, it is determined whether the upper-level partner has the extended calling authority of the preset functional interface.
[0103] In some embodiments of the present application, the authorized partner call tracking chain is stored in a binary tree structure, the root node of the binary tree structure corresponds to the original function interface provider; the right child node in the binary tree is an extension node, and the extension node corresponds to the partner developed by the parent node of the right child node; the left child node in the binary tree is a non-extended node, and the non-extended node corresponds to the partner at the same level as the parent node of the left child node; the correspondence between the generated partner code and the interface call tracking chain is incrementally stored in the authorized partner call tracking chain, including:
[0104] Traverse each node in the authorized partner call tracking chain to obtain the node corresponding to the upper-level partner;
[0105] A right child node of the node corresponding to the upper-level partner is established, and the matching relationship between the generated partner code and the interface call tracking chain is stored in the established right child node.
[0106] In some embodiments of the present application, Figure 5 As shown, the device also includes:
[0107] The interface normalization module 400 is used to obtain the functional interface in the service protocol and perform normalization processing on the interface code and interface request parameters of the functional interface;
[0108] The call tracking chain data storage module 402 is used for storing the authorized partner call tracking chain of each functional interface according to the pre-configured authorized call relationship between the partner and the functional interface;
[0109] The function interface improvement module 404 is used to add a calling authority parameter to the interface request parameter of each function interface, wherein the calling authority parameter includes: a partner code and an interface calling tracking chain;
[0110] The call source data monitoring setting module 406 is used to set the call source data monitoring of the functional interface. The call source data monitoring is used to respond to the call of the functional interface and perform monitoring processing of the call source data based on the interface request parameters.
[0111] The interface call processing device based on the developer's extended scenario disclosed in the embodiment of the present application is used to implement the interface call processing method based on the developer's extended scenario described in the first embodiment of the present application. The specific implementation methods of each module of the device will not be repeated here, and reference can be made to the specific implementation methods of the corresponding steps in the method embodiment.
[0112] The interface call processing device based on the developer's extended scenario disclosed in the embodiment of the present application obtains the interface request parameters matching the call and the authorized partner call tracking chain pre-configured for the current functional interface in response to the call to the current functional interface; verifies the partner information carried in the interface request parameters and the interface call tracking chain based on the authorized partner call tracking chain; executes the current functional interface based on the interface request parameters in response to successful verification of the interface request parameters; intercepts the call in response to failure of verification of the interface request parameters; stores the call record of the current functional interface, wherein the call record carries one or more of the following information: the current functional interface, the interface request parameters, and the result of verifying the interface request parameters, which helps to collect more fine-grained interface call scenario data, such as call link data.
[0113] The interface call processing device based on the developer extension scenario disclosed in the embodiment of the present application establishes a call tracking chain to store the partner development extension relationship of each functional interface and the partner's interface call tracking chain, and verifies the call link and the development extension relationship during the process of the functional interface being called, so that the functional interface call analysis data with more granularity and dimensions can be obtained based on the stored call records. For example, functional interface call data based on the partner dimension and call data based on the functional interface dimension are obtained.
[0114] On the other hand, by adding the information of the superior partner and the interface call tracking chain of the current caller to the input parameters of the functional interface, and setting up call source data monitoring to verify the interface request parameters when the functional interface is called, not only can the accurate call link of the functional interface be recorded, but also when an exception occurs in the call, the partner who called the functional interface and the interface request parameters can be accurately located, and the exception data can be output to the exception data processing system for exception analysis, which helps to improve the maintenance efficiency of the business system.
[0115] Furthermore, by pre-standardizing the functional interface and checking the interface request parameters when the functional interface is called, it helps to promote the standardization of the functional interface.
[0116] Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0117] The above is a detailed introduction to an interface call processing method and device based on a developer extension scenario provided by the present application. This article uses specific examples to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, based on the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
[0118] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0119] The various component embodiments of the present application can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all functions of some or all components in the electronic device according to the embodiment of the present application. The present application can also be implemented as a device or apparatus program (e.g., computer program and computer program product) for executing part or all of the methods described herein. Such a program implementing the present application can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0120] For example, Figure 6 An electronic device that can implement the method according to the present application is shown. The electronic device can be a PC, a mobile terminal, a personal digital assistant, a tablet computer, etc. The electronic device traditionally includes a processor 610 and a memory 620 and a program code 630 stored on the memory 620 and can be run on the processor 610, and the processor 610 implements the method described in the above embodiment when executing the program code 630. The memory 620 can be a computer program product or a computer-readable medium. The memory 620 can be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk or a ROM. The memory 620 has a storage space 6201 for the program code 630 of a computer program for executing any method step in the above method. For example, the storage space 6201 for the program code 630 can include various computer programs for implementing the various steps in the above method respectively. The program code 630 is a computer-readable code. These computer programs can be read from one or more computer program products or written into the one or more computer program products. These computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks. The computer program includes a computer readable code, and when the computer readable code is executed on an electronic device, the electronic device is caused to execute the method according to the above embodiment.
[0121] The embodiment of the present application also discloses a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the interface call processing method based on the developer's extended scenario as described in the first embodiment of the present application are implemented.
[0122] Such a computer program product may be a computer-readable storage medium, which may have a computer-readable storage medium having a Figure 6 The memory 620 in the electronic device shown in the figure is similar to the storage segment, storage space, etc. The program code can be compressed and stored in the computer-readable storage medium in an appropriate form. The computer-readable storage medium is generally as shown in the reference Figure 7 The portable or fixed storage unit. Generally, the storage unit includes computer readable code 630', which is a code read by a processor. When the code is executed by the processor, each step in the method described above is implemented.
[0123] The term "one embodiment", "embodiment" or "one or more embodiments" herein means that a particular feature, structure or characteristic described in conjunction with the embodiment is included in at least one embodiment of the present application. In addition, please note that the examples of the term "in one embodiment" here do not necessarily all refer to the same embodiment.
[0124] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0125] In the claims, any reference signs placed between brackets shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application may be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names.
[0126] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. An interface call processing method based on developer extended scenarios, characterized in that: include: In response to calling the current functional interface, obtaining interface request parameters matched by the call, and obtaining a call tracking chain of an authorized partner pre-configured for the current functional interface; The authorized partner call tracking chain includes the development extension relationship of the partner who has been authorized to call the current functional interface and the partner's interface call tracking chain; Based on the authorized partner call tracking chain, verify the partner information and the interface call tracking chain carried in the interface request parameters; In response to the interface request parameter verification being successful, executing the current functional interface based on the interface request parameter; In response to the interface request parameter verification failing, intercepting the call; Storing a call record of the current functional interface, the call record carrying one or more of the following information: the current functional interface, the interface request parameters, and a result of verifying the interface request parameters; Wherein, the verifying the partner information and the interface call tracking chain carried in the interface request parameter based on the authorized partner call tracking chain also includes: Determine whether the matching relationship between the partner information carried in the interface request parameters and the interface call tracking chain, the development and extension relationship with the partner authorized to call the current functional interface, and the interface call tracking chain stored in the authorized partner call tracking chain match.
2. The method according to claim 1, characterized in that: The step of verifying the partner information and the interface call tracking chain carried in the interface request parameter based on the authorized partner call tracking chain includes: In response to the matching relationship between the partner information carried in the interface request parameter and the interface call tracking chain, the development extension relationship with the partner authorized to call the current functional interface, and the matching of the interface call tracking chain stored in the authorized partner call tracking chain, it is determined that the interface request parameter verification is successful; In response to the matching relationship between the partner information carried in the interface request parameters and the interface call tracking chain, the development and extension relationship with the partner who has been authorized to call the current functional interface, and the mismatch between the interface call tracking chain stored in the authorized partner call tracking chain, it is determined that the interface request parameter verification has failed.
3. The method according to claim 2, characterized in that The authorized partner call tracking chain is stored in a binary tree structure, the root node of the binary tree structure corresponds to the original function interface provider; the right child node in the binary tree is an extension node, and the extension node corresponds to the partner developed by the parent node of the right child node; The left child node in the binary tree is a non-extended node, and the non-extended node corresponds to a partner at the same level as the parent node of the left child node; The step of determining whether the matching relationship between the partner information carried in the interface request parameter and the interface call tracking chain, the development extension relationship with the partner authorized to call the current functional interface, and the interface call tracking chain stored in the authorized partner call tracking chain match, includes: By traversing the authorized partner call tracking chain stored in a binary tree structure, a left child node or a right child node corresponding to the partner information carried in the interface request parameter is obtained as a node to be matched; According to the development extension relationship of the partners authorized to call the current functional interface stored in the binary tree structure, the interface call tracking chain of the right child node of the node to be matched is obtained as the interface call tracking chain to be matched; Compare the interface call tracking chain carried in the interface request parameter with the interface call tracking chain to be matched; In response to the comparison being successful, determining a matching relationship between the partner information carried in the interface request parameter and the interface call tracking chain, a development extension relationship with the partner authorized to call the current functional interface, and an interface call tracking chain stored in the authorized partner call tracking chain; In response to the comparison failure, determining the matching relationship between the partner information carried in the interface request parameters and the interface call tracking chain, the development extension relationship with the partner authorized to call the current functional interface, and the interface call tracking chain stored in the authorized partner call tracking chain do not match.
4. The method according to claim 1, characterized in that Before the step of obtaining the authorized partner call tracking chain pre-configured for the current functional interface, the method includes: In response to obtaining a call permission request for a preset function interface, obtaining a partner matching the call permission request, and developing a superior partner of the partner; Based on the authorized partner call tracking chain pre-configured for the preset function interface, determining whether the upper-level partner has the extended call authority for the preset function interface; In response to the superior partner having the extended calling authority of the preset functional interface, generating a partner code of the partner and an interface calling tracking chain authorizing the partner to call the preset functional interface; The generated correspondence between the partner code and the interface call tracking chain is incrementally stored in the authorized partner call tracking chain.
5. The method according to claim 4, characterized in that The authorized partner call tracking chain is stored in a binary tree structure, the root node of the binary tree structure corresponds to the original function interface provider; the right child node in the binary tree is an extension node, and the extension node corresponds to the partner developed by the parent node of the right child node; The left child node in the binary tree is a non-extended node, and the non-extended node corresponds to a partner at the same level as the parent node of the left child node; Each node of the authorized partner call tracking chain stores the interface providing identifier of the corresponding partner, which is used to indicate whether the partner provides the preset function interface to the developed partner; The step of determining whether the upper-level partner has the extended calling authority of the preset function interface based on the authorized partner calling tracking chain pre-configured by the preset function interface includes: Traverse each node in the authorized partner call tracking chain to obtain the node corresponding to the upper-level partner; According to the interface provision identifier stored in the node corresponding to the upper-level partner, it is determined whether the upper-level partner has the extended calling authority of the preset functional interface.
6. The method according to claim 4, characterized in that The authorized partner call tracking chain is stored in a binary tree structure, the root node of the binary tree structure corresponds to the original function interface provider; the right child node in the binary tree is an extended node, and the extended node corresponds to the partner developed by the parent node of the right child node; the left child node in the binary tree is a non-extended node, and the non-extended node corresponds to the partner at the same level as the parent node of the left child node; The step of incrementally storing the generated correspondence between the partner code and the interface call tracking chain in the authorized partner call tracking chain includes: Traverse each node in the authorized partner call tracking chain to obtain the node corresponding to the upper-level partner; A right child node of the node corresponding to the upper-level partner is established, and the matching relationship between the generated partner code and the interface call tracking chain is stored in the established right child node.
7. The method according to any one of claims 1 to 6, characterized in that: Before the step of obtaining the interface request parameter matched by the call in response to the call of the current functional interface, the method further includes: Obtaining the functional interface in the business protocol, and normalizing the interface code and interface request parameters of the functional interface; According to the pre-configured authorized calling relationship between the partners and the functional interfaces, storing the authorized partner calling tracking chain of each functional interface; In the interface request parameters of each of the functional interfaces, a calling authority parameter is added, wherein the calling authority parameter includes: a partner code and an interface calling tracking chain; The calling source data monitoring of the functional interface is set, and the calling source data monitoring is used to respond to the calling of the functional interface and perform monitoring processing of the calling source data based on the interface request parameters.
8. An interface call processing device based on developer extended scenarios, characterized in that: include: An interface request parameter and configuration data acquisition module, used to respond to a call to a current functional interface, acquire the interface request parameters matched by the call, and acquire a call tracking chain of an authorized partner pre-configured for the current functional interface; The authorized partner call tracking chain includes the development extension relationship of the partner who has been authorized to call the current functional interface and the partner's interface call tracking chain; An interface request parameter verification module, used to verify the partner information and the interface call tracking chain carried in the interface request parameters based on the authorized partner call tracking chain; A function interface call processing module, configured to execute the current function interface based on the interface request parameters in response to successful verification of the interface request parameters; The functional interface call processing module is further used to intercept the call in response to the interface request parameter verification failure; A call record storage module, used to store the call record of the current functional interface, wherein the call record carries one or more of the following information: the current functional interface, the interface request parameters, and the result of verifying the interface request parameters; Among them, the interface request parameter verification module is specifically used to determine the matching relationship between the partner information carried in the interface request parameters and the interface call tracking chain, the development extension relationship with the partner who has been authorized to call the current functional interface, and the interface call tracking chain stored in the authorized partner call tracking chain.
9. An electronic device comprising a memory, a processor, and a program code stored in the memory and executable on the processor, characterized in that: When the processor executes the program code, the interface call processing method based on the developer's extended scenario as described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having program code stored thereon, characterized in that: When the program code is executed by a processor, the steps of the interface call processing method based on the developer's extended scenario as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Method and device for treating call request of interface
CN105897782A
A method and device for generating an interface test report
CN109376064A