Application system interface automatic identification and conversion method, device, equipment and medium
By extracting API data structure information, generating field mapping relationships, and using a visual rule editor, the problem of API data parsing and transformation being unable to support dynamic changes in existing technologies is solved, achieving efficient data format standardization and system integration.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PENGHUA FUND MANAGEMENT CO LTD
- Filing Date
- 2025-04-07
- Publication Date
- 2026-04-10
AI Technical Summary
In existing technologies, API data parsing and conversion are based on fixed mapping relationships, which makes it difficult to support dynamic API changes, resulting in low interface adaptation efficiency and high maintenance costs.
By acquiring request and response data from API interfaces, extracting data structure information, deriving JSON Schema and generating field mapping relationships, using the visual Jolt rule editor to generate data transformation rules, establishing a hierarchical rule system, parsing response data and standardizing the structure, and publishing the transformed data structure after validating it through JSON Schema rules.
It improves the automation of API adaptation, ensures data format standardization, reduces maintenance costs, enhances data interoperability and stability across different systems, and improves system integration efficiency.
Smart Images

Figure CN120371904B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of interface data processing, in particular to an application system interface automatic identification and conversion method and device, equipment and medium. BACKGROUND
[0002] At present, with the rapid development of information systems, the demand for data interaction between different application systems is increasing. API (Application Program Interface) has become the main way of system integration and data sharing, especially in micro-service architecture, cloud computing and enterprise-level information systems. The automatic adaptation and data conversion capability of API interface plays a key role in system compatibility and data flow efficiency.
[0003] The existing API data parsing and conversion are mainly based on conversion engines with fixed mapping relationships. When facing different API versions, complex JSON structures and multi-level nested data, it is easy to cause inaccurate parsing, complex data conversion and difficult rule management. In addition, some API adaptation schemes use static mapping methods, which are difficult to support dynamic API structure changes, resulting in the need to frequently adjust the conversion logic during system upgrade, increasing the maintenance cost.
[0004] The existing technical solutions in the above have the following defects: API data parsing and conversion are based on fixed mapping relationships, which are difficult to support dynamic API changes, resulting in low interface adaptation efficiency and high maintenance cost, so there is room for improvement. SUMMARY
[0005] In order to improve the adaptation efficiency of the interface, the present application provides an application system interface automatic identification and conversion method, device, equipment and medium.
[0006] The above invention purpose of the present application is realized by the following technical solutions:
[0007] An application system interface automatic identification and conversion method, the method comprises:
[0008] Obtaining the request data and response data of the API interface, and extracting the API data structure information based on the request data and the response data, and then deriving the JSON Schema and generating the field mapping relationship;
[0009] According to the field mapping relationship, a visual Jolt rule editor is used to generate data conversion rules, and a rule hierarchical system is established;
[0010] The response data of the API interface is parsed, and then the data structure is extracted and standardized to generate a structured data object;
[0011] According to the rule hierarchical system, data conversion is performed on the structured data object, the converted data structure is checked by a JSON Schema rule, a converted data structure is generated, and the converted data structure is published.
[0012] By adopting the technical solutions, the API data structure information is extracted based on the request data and the response data, the JSON Schema is derived, and the field mapping relationship is generated, so that the API data structure can be automatically parsed, the workload of manual analysis and data format configuration is reduced, the automation degree of API adaptation is improved, the standardization of data format is ensured, and the data compatibility between different systems is improved; the data conversion rule is generated by using the visual Jolt rule editor, and the rule hierarchical system is established, so that an intuitive and efficient conversion rule management mode can be provided, the data mapping and conversion logic are more clear, the maintenance cost is reduced, and the scalability of the data conversion rule is improved; the API response data is parsed, the data structure is extracted and standardized, the structured data object is generated, so that the uniformity of the data structure is ensured, the format difference caused by inconsistent API design is eliminated, the data processability is improved, and the interoperability of data between different systems is improved; the structured data object is converted according to the rule hierarchical system, the converted data structure is checked by the JSON Schema rule, the converted data structure is generated and published, so that the data conversion conforms to the target data format, the data loss or format exception caused by conversion errors is reduced, the stability of data conversion is improved, and the converted data can be automatically published, so that the data can quickly adapt to the target system, and the system integration efficiency is improved.
[0013] In an example, the application can be further configured to: the API data structure information is extracted based on the request data and the response data, and the JSON Schema is derived and the field mapping relationship is generated, specifically including:
[0014] The hierarchical relationship of the request data and the response data is analyzed by using a structured analysis method, and the nested level of the data structure is identified based on a JSON format analysis rule;
[0015] In combination with a pattern matching algorithm, the field name, data type and hierarchical structure of the response data are detected, and an API data structure information table is constructed, and then the field mapping relationship is generated.
[0016] By adopting the technical solution, the hierarchical relationship of the request data and the response data is analyzed by adopting the structural analysis method, and the nested level of the data structure is identified based on the JSON format analysis rule, so that the data level and the organization mode of the API can be accurately extracted, the analysis error caused by the complex JSON structure can be avoided, the data integrity of the extracted data can be ensured, and the readability and consistency of the data format can be improved; by combining the pattern matching algorithm to detect the field name, the data type and the hierarchical structure of the response data, and constructing the API data structure information table, and then generating the field mapping relationship, the accuracy of the field matching can be improved, the need for manual configuration of the field mapping can be reduced, the efficiency of the API adaptation can be improved, and the API version compatibility can be enhanced.
[0017] In an example, the application can be further configured to: according to the field mapping relationship, generating a data conversion rule by using a visual Jolt rule editor, and establishing a rule hierarchical system, specifically including:
[0018] According to the Jolt rule editor, the API data structure information is interactively mapped;
[0019] According to the field mapping relationship, and based on a preset conversion rule library, a conversion rule of a corresponding field is determined by a matching algorithm;
[0020] According to the complexity of the conversion rule, the rule hierarchical system is established.
[0021] By adopting the technical solution, the API structure and the target data structure can be intuitively mapped by interactively mapping the API data structure information, the workload of manually analyzing the API structure can be reduced, the operability and accuracy of the data mapping can be improved; by determining the conversion rule of the corresponding field by the matching algorithm based on the preset conversion rule library, the data conversion mode can be automatically identified and adapted, the need for manually writing the conversion rule can be reduced, the execution efficiency of the conversion rule can be improved, and the adaptability of the data conversion can be enhanced; by establishing the rule hierarchical system according to the complexity of the conversion rule, the conversion rules of different complexities can be managed in layers, the data conversion logic can be more clear and orderly, the execution efficiency of the data conversion can be improved, and the maintenance cost can be reduced.
[0022] In an example, the application can be further configured to: according to the complexity of the conversion rule, the rule hierarchical system is established, specifically including:
[0023] According to the complexity of the conversion rule, the hierarchical level is divided according to a preset complexity threshold, wherein the hierarchical level includes a basic conversion layer, an advanced conversion layer and an extended conversion layer;
[0024] For the basic conversion layer, an index-driven parsing strategy is adopted to directly search the basic fields with stable structure;
[0025] For the advanced conversion layer, combined with JSON structure analysis, the nested data is parsed at different levels, and the complex JSON structure is adapted;
[0026] For the extension conversion layer, based on the dynamic API structure, combined with the custom parsing logic, the data with calculation and / or conversion requirements is preprocessed.
[0027] By adopting the above technical solutions, according to the complexity of the conversion rule, the hierarchical division is performed according to the preset complexity threshold, different types of conversion requirements can be reasonably classified, the data conversion logic is more clear, the execution efficiency of the conversion process is improved, and the performance overhead caused by complex conversion logic is reduced; for the basic conversion layer, an index-driven parsing strategy is adopted to directly search the basic fields with stable structure, which can improve the parsing speed of the basic data, reduce the traversal calculation, and improve the data processing performance; for the advanced conversion layer, combined with JSON structure analysis, the nested data is parsed at different levels, and the complex JSON structure is adapted, which can ensure that the conversion of the nested JSON structure conforms to the target API specification, thereby improving the conversion accuracy of the complex data structure, avoiding data damage or loss caused by hierarchical parsing errors; for the extension conversion layer, based on the dynamic API structure, combined with the custom parsing logic, the data with calculation and / or conversion requirements is preprocessed, which can adapt to the dynamic changes of the API structure, making the data conversion process more adaptive, thereby enhancing the compatibility during API version upgrade, and reducing the data conversion failure caused by API changes.
[0028] In an example, the application can be further configured to: the response data of the parsing API interface is further extracted and standardized to generate a structured data object, specifically including:
[0029] Based on the field mapping relationship, the necessary fields in the response data are screened;
[0030] Combined with the rule hierarchical system, the corresponding parsing fields are determined for conversion rules with different complexities;
[0031] According to the necessary fields and the parsing fields, a parsing request is generated, and the structured data object is generated according to the parsing request.
[0032] By adopting the technical scheme, necessary fields in response data are filtered based on the field mapping relationship, irrelevant fields in the data analysis process are reduced, the data analysis efficiency is improved, the computing resource consumption is reduced, and the system performance is optimized; by combining the rule hierarchical system, the corresponding analysis field is determined according to the conversion rule of different complexity, the data analysis range is automatically adjusted according to the complexity of the rule, the analysis calculation burden is reduced, and the execution efficiency of the analysis logic is improved; by generating an analysis request according to the necessary field and the analysis field, and generating a structured data object according to the analysis request, it can be ensured that the analyzed data meets the target data format requirement, thereby improving the standardization degree of the data and providing stable input for subsequent data conversion.
[0033] In an example, the application can be further configured to: the structured data object is subjected to data conversion according to the rule hierarchical system, and the converted data structure is verified by a JSON Schema rule to generate a converted data structure, specifically including:
[0034] According to the conversion complexity of the structured data object, the corresponding data conversion is performed according to the rule hierarchical system;
[0035] In combination with the JSON Schema rule, the data integrity check is performed, and the format optimization of the converted data structure is performed according to the target API specification to generate the converted data structure.
[0036] By adopting the technical scheme, the corresponding data conversion is performed according to the conversion complexity of the structured data object and the rule hierarchical system, the optimal conversion mode can be selected for different complexity data conversion requirements, the flexibility of data conversion is improved, and it is ensured that the data conversion meets the business requirements; by combining the JSON Schema rule, the data integrity check is performed, and the converted data structure is optimized according to the target API specification, it is ensured that the converted data meets the expected data format standard, thereby improving the correctness of data conversion, avoiding data transmission failure or system abnormality caused by format error, and improving the stability of data interaction between systems.
[0037] The second application purpose is achieved by the following technical scheme:
[0038] An application system interface automatic identification and conversion device, the device comprises:
[0039] A data extraction module is configured to obtain request data and response data of an API interface, extract API data structure information based on the request data and the response data, and further derive a JSON Schema and generate a field mapping relationship;
[0040] A rule generation module is configured to generate a data conversion rule by using a visual Jolt rule editor according to the field mapping relationship, and establish a rule hierarchical system.
[0041] A data analysis module is configured to analyze the response data of the API interface, and then extract and standardize a data structure to generate a structured data object.
[0042] A data conversion and publishing module is configured to perform data conversion on the structured data object according to the rule hierarchical system, and check the converted data structure by using a JSON Schema rule to generate a converted data structure, and then publish the converted data structure.
[0043] By using the above technical solutions, the API data structure information is extracted based on the request data and the response data, and the JSON Schema is derived and the field mapping relationship is generated, so that the API data structure can be automatically analyzed, the workload of manually analyzing and configuring the data format is reduced, the automation degree of API adaptation is improved, the standardization of the data format is ensured, and the data compatibility between different systems is improved. By using the visual Jolt rule editor to generate the data conversion rule and establishing the rule hierarchical system, an intuitive and efficient conversion rule management mode can be provided, the data mapping and conversion logic are more clear, the maintenance cost is reduced, and the scalability of the data conversion rule is improved. By analyzing the API response data, extracting and standardizing the data structure, and generating the structured data object, the uniformity of the data structure can be ensured, the format difference caused by inconsistent API design is eliminated, the data processability is improved, and the interoperability of the data between different systems is improved. By performing data conversion on the structured data object according to the rule hierarchical system, and checking the converted data structure by using the JSON Schema rule to generate the converted data structure and publish it, it can be ensured that the data conversion conforms to the target data format, the data loss or format exception caused by conversion errors is reduced, the stability of the data conversion is improved, and the automatic publishing of the converted data is supported, so that the data can quickly adapt to the target system and the system integration efficiency is improved.
[0044] The above-mentioned third purpose of the application is achieved by the following technical solutions:
[0045] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor executes the computer program to implement the steps of the above-mentioned application system interface automatic identification and conversion method.
[0046] The above-mentioned fourth purpose of the application is achieved by the following technical solutions:
[0047] A computer readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the application system interface automatic identification and conversion method.
[0048] In summary, the present application includes the following beneficial technical effects:
[0049] 1、By extracting API data structure information based on request data and response data, and then deriving JSONSchema and generating field mapping relationship, the API data structure can be automatically parsed, reducing the workload of manual analysis and data format configuration, thereby improving the automation degree of API adaptation, ensuring the standardization of data format, and improving the data compatibility between different systems; By using a visual Jolt rule editor to generate data conversion rules and establishing a rule hierarchy, an intuitive and efficient conversion rule management method can be provided, making the data mapping and conversion logic more clear, thereby reducing maintenance costs and improving the scalability of data conversion rules; By parsing API response data, extracting and standardizing the data structure, and generating structured data objects, the uniformity of the data structure can be ensured, and the format differences caused by inconsistent API design can be eliminated, thereby enhancing the processability of data and improving the interoperability of data between different systems; By converting structured data objects according to the rule hierarchy, and checking the converted data structure through JSON Schema rules, generating converted data structure and publishing, the data conversion can be ensured to comply with the target data format, reducing data loss or format abnormalities caused by conversion errors, thereby improving the stability of data conversion and supporting the automatic publishing of converted data, so that data can quickly adapt to the target system and improve system integration efficiency;
[0050] 2、By using a structured parsing method to analyze the hierarchical relationship of request data and response data, and identifying the nested level of data structure based on JSON format parsing rules, the data level and organization method of API can be accurately extracted, avoiding parsing errors caused by complex JSON structure, thereby ensuring the integrity of the extracted data and improving the readability and consistency of the data format; By combining pattern matching algorithm to detect the field name, data type and hierarchical structure of response data, and constructing API data structure information table, and then generating field mapping relationship, the accuracy of field matching can be improved, reducing the need for manual configuration of field mapping, thereby improving the efficiency of API adaptation and enhancing the API version compatibility;
[0051] 3、Through the interactive mapping of the API data structure information, intuitive mapping of the API structure and the target data structure can be realized, the workload of manually analyzing the API structure is reduced, and thus the operability and accuracy of data mapping are improved; through the preset conversion rule library, the conversion rule of the corresponding field is determined through a matching algorithm, the data conversion mode can be automatically identified and adapted, the need for manually writing the conversion rule is reduced, the execution efficiency of the conversion rule is improved, and the adaptability of data conversion is enhanced; through the rule hierarchical system established according to the complexity of the conversion rule, hierarchical management of conversion rules of different complexities can be performed, the data conversion logic is more clear and orderly, and thus the execution efficiency of data conversion is improved and the maintenance cost is reduced. BRIEF DESCRIPTION OF DRAWINGS
[0052] Figure 1 is a flowchart of an application system interface automatic identification and conversion method in an embodiment of the present application;
[0053] Figure 2 is an implementation flowchart of step S10 in the application system interface automatic identification and conversion method in an embodiment of the present application;
[0054] Figure 3 is an implementation flowchart of step S20 in the application system interface automatic identification and conversion method in an embodiment of the present application;
[0055] Figure 4 is an implementation flowchart of step S23 in the application system interface automatic identification and conversion method in an embodiment of the present application;
[0056] Figure 5 is an implementation flowchart of step S30 in the application system interface automatic identification and conversion method in an embodiment of the present application;
[0057] Figure 6 is an implementation flowchart of step S40 in the application system interface automatic identification and conversion method in an embodiment of the present application;
[0058] Figure 7 is a principle block diagram of an application system interface automatic identification and conversion device in an embodiment of the present application;
[0059] Figure 8 is a device schematic diagram in an embodiment of the present application. DETAILED DESCRIPTION
[0060] The present application will be further described in detail below with reference to the accompanying drawings.
[0061] In an embodiment, as shown in Figure 1 , the present application discloses an application system interface automatic identification and conversion method, specifically including the following steps:
[0062] S10: Obtain the request data and response data of the API interface, and extract the API data structure information based on the request data and response data, and then derive the JSON Schema and generate the field mapping relationship.
[0063] Specifically, a test request is sent to the API interface, the returned response data is captured, the parameter structure and content in the request data are recorded, the JSON structure of the API response data is parsed, the hierarchical relationship, field type and nested structure of the data fields are identified, the data organization method of the API is derived based on the association between the request data and the response data, the JSON Schema structure definition is generated according to the parsing result, and it is ensured that the name, data type and hierarchical structure of all fields comply with the actual data format of the API, and the corresponding relationship between the fields is extracted to establish the field mapping relationship to support the generation of subsequent data conversion rules.
[0064] S20: According to the field mapping relationship, generate data conversion rules using a visual Jolt rule editor, and establish a rule hierarchical system.
[0065] Specifically, based on the generated field mapping relationship, the API data structure information and the target data structure information are visualized and displayed, interactive operations are provided through the Jolt rule editor, users can intuitively define data conversion rules, the system automatically parses the field hierarchy and recommends conversion mapping schemes, users can adjust the fields by dragging, and automatic matching function is provided to reduce the complexity of manual configuration, the conversion rules are classified into different hierarchical structures according to the conversion complexity of the fields, forming a rule hierarchical system to ensure efficient processing according to the applicable scope and complexity of the rules during data conversion.
[0066] S30: Parse the response data of the API interface, and then extract and standardize the data structure to generate a structured data object.
[0067] Specifically, the JSON response data returned by the API is received, the related fields are filtered according to the established field mapping relationship, the fields with inconsistent data formats are standardized, such as unifying the date format to ISO 8601, converting numerical data to a uniform unit, and standardizing Boolean values to true / false, for nested JSON structure data, the data is reorganized in the form of hierarchical expansion or merging to meet the requirements of the target data structure, and finally a structured data object is constructed to ensure the data format, hierarchical relationship and content integrity for subsequent data conversion.
[0068] S40: Data conversion is performed on the structured data object according to the rule hierarchical system, and the converted data structure is checked by the JSON Schema rule to generate a converted data structure, and then the converted data structure is published.
[0069] Specifically, according to the rule hierarchical system, data conversion is performed according to the conversion rules of different levels in sequence, the fields of the basic conversion layer are directly mapped first, then the fields of the high-level conversion layer are adjusted in structure, such as field level conversion, field splitting and merging, finally the fields of the extended conversion layer are applied API compatibility adaptation and calculation logic processing, after the conversion, the generated data structure is checked by the JSON Schema, the data integrity, field type matching and level consistency are checked to ensure that the converted data meets the requirements of the target API, and finally the converted data structure is published, which can be used for actual API calling or storage to support the data interaction needs of the business system.
[0070] In an embodiment, as shown in FIG. 1, in step S10, the API data structure information is extracted based on the request data and the response data, and then the JSON Schema is derived and the field mapping relationship is generated, which specifically includes: Figure 2
[0071] S11: A structured parsing method is used to analyze the hierarchical relationship of the request data and the response data, and the nested level of the data structure is identified based on the JSON format parsing rule.
[0072] Specifically, when parsing the structure of the request data and the response data, the main level of the JSON data is first traversed to identify all the top key names, then the type of the value of each key name is judged, if the value is an object type, the internal structure is further recursively parsed to extract the field name and data type information, and the nesting relationship is recorded, and the array structure is specially processed to detect the type consistency of the elements in the array to ensure that the subsequent Schema generation can accurately express the data structure.
[0073] S12: The field name, data type and hierarchical structure of the response data are detected by combining the pattern matching algorithm, and an API data structure information table is constructed to generate a field mapping relationship.
[0074] Specifically, when parsing the field name, a pattern matching algorithm is used to compare the existing API structure information and the currently parsed data field, and the similarity matching algorithm of the field name is used to identify the possible field correspondence. At the same time, through the data type inference method, it is analyzed whether the value of the field conforms to the JSON Schema standard, such as integer, floating point number, Boolean value and other standard types. If the field name similarity is high but the data type does not match, it is marked as suspicious mapping and stored in the API data structure information table. Finally, combined with the field mapping relationship, the current API structure information is compared with the existing API structure, and the optimal field mapping scheme is generated.
[0075] In an embodiment, as shown in FIG. 20, in step S20, a data conversion rule is generated using a visual Jolt rule editor according to the field mapping relationship, and a rule hierarchy is established, which specifically includes: Figure 3
[0076] S21: According to the Jolt rule editor, the API data structure information is interactively mapped.
[0077] Specifically, after loading the API data structure information, it is visualized and displayed on the left panel of the editor, and the target data structure is displayed on the right panel. The user is allowed to map the fields from the API data structure to the target data structure through a drag-and-drop operation. At the same time, an automatic mapping recommendation function is provided to recommend the best field mapping scheme based on historical data conversion experience. The user can manually adjust the mapping relationship, interactively modify the JSON structure level, and real-time preview the converted JSON structure to ensure the accuracy of the mapping.
[0078] S22: According to the field mapping relationship, and based on the preset conversion rule library, the conversion rule of the corresponding field is determined through a matching algorithm.
[0079] Specifically, in the field mapping process, first, the preset conversion rule library is searched to match whether the current API field has a corresponding conversion rule. If there is a matching rule, it is directly applied. Otherwise, the conversion rule is automatically derived through a pattern matching algorithm, for example, for fields with high field name similarity but different levels, a recommendation is made to merge or adjust the level conversion. For fields with different data types but can be converted (such as string to numerical value), a type conversion rule is recommended. Finally, the conversion rule is automatically generated and stored in the Jolt rule library.
[0080] S23: According to the complexity of the conversion rule, a rule hierarchy is established.
[0081] Specifically, all generated transformation rules are analyzed and their complexity is calculated. Simple field mapping rules are assigned to the basic transformation layer, rules involving hierarchical adjustments and structure merging are assigned to the advanced transformation layer, and rules involving API version compatibility and dynamic adjustment logic are assigned to the extended transformation layer. Rules at different levels are applied in the order of execution during the transformation process to ensure the correctness and efficiency of data transformation.
[0082] In one embodiment, such as Figure 4 As shown, in step S23, a hierarchical rule system is established based on the complexity of the transformation rules, specifically including:
[0083] S231: Based on the complexity of the conversion rules, the system is divided into layers according to a preset complexity threshold. The layers include a basic conversion layer, an advanced conversion layer, and an extended conversion layer.
[0084] Specifically, when calculating the complexity of a conversion rule, the field mapping relationship of the rule is first analyzed, including factors such as the number of fields, field hierarchy, and data type conversion. Then, the rules are divided into levels based on a preset complexity threshold. If the conversion rule only involves simple field mapping or data type conversion and has no nested structure adjustment, it is classified as the basic conversion layer. If the conversion rule involves JSON hierarchy structure adjustment, field merging and splitting, it is classified as the advanced conversion layer. If the conversion rule involves complex processing methods such as API version change adaptation, dynamic field processing, and calculation logic, it is classified as the extended conversion layer. After the level division, each conversion rule is stored in the corresponding conversion rule library and parsed and processed in hierarchical order during data conversion.
[0085] S232: For the basic transformation layer, an index-driven parsing strategy is adopted to directly look up the basic fields with stable structures.
[0086] Specifically, when parsing fields in the basic transformation layer, a field index table is first created to index the basic fields in the API data structure information and look them up according to the key-value mapping method. When parsing API response data, the fields are located directly based on the index table without traversing the entire JSON structure, thereby improving parsing efficiency. Simple data type conversions are performed on the values of the basic fields, such as string to integer and boolean conversion, to ensure the stability of the data structure. After parsing, the conversion results are stored in a structured data object and the conversion status is marked to ensure that the conversion results of the basic fields can be used for subsequent transformation layer processing.
[0087] S233: For advanced conversion layers, it combines JSON structure analysis to perform hierarchical parsing of nested data and adapt to complex JSON structures.
[0088] Specifically, when parsing the fields of the advanced conversion layer, first, the nested fields of the API response data are detected, the hierarchical relationship in the JSON structure is identified, each nested field is hierarchically expanded, and it is determined whether to need to merge, split or adjust the hierarchy according to the data conversion rule. For the fields that need to adjust the hierarchy, the path mapping is recalculated, and the JSON hierarchy is reconstructed according to the target API structure. If there is an array structure, the array element type is analyzed to ensure that the converted array structure is consistent with the target API specification. After parsing, the processed data is stored in the structured data object, and the field mapping of the advanced conversion layer is ensured to meet the API adaptation requirements.
[0089] S234: For the extended conversion layer, based on the dynamic API structure, combined with the custom parsing logic, the data with calculation and / or conversion requirements is preprocessed.
[0090] Specifically, when parsing the fields of the extended conversion layer, first, it is detected whether the API structure has dynamic changes, such as field name change, field deletion, new field addition, etc., and the conversion logic is adjusted according to the API version adaptation rule. If the API version changes, the historical API structure is automatically matched, and the optimal compatibility strategy is applied to ensure data adaptability. For fields with calculation requirements, the calculation rule is executed according to the custom parsing logic, such as field value unit conversion, time format conversion, string concatenation, etc. The calculation result is stored in the target data structure. If there is an incompatible situation during the conversion, an error log is recorded, and a manual adjustment option is provided to ensure the flexibility and traceability of data conversion.
[0091] In an embodiment, as shown in FIG. 3, Figure 5 In step S30, the response data of the API interface is parsed, and then the data structure is extracted and standardized to generate a structured data object, which specifically includes:
[0092] S31: Based on the field mapping relationship, the necessary fields in the response data are filtered.
[0093] Specifically, first, the field mapping relationship table is loaded, the API response data is traversed, and it is matched whether the fields in the API response data are in the mapping relationship. If the field exists in the mapping relationship, it is marked as a necessary field, otherwise it is skipped. The parsing reduces the processing of irrelevant fields, and at the same time, the nested JSON structure is expanded, and only the fields involved in the mapping relationship are retained to ensure that the extracted data fields are minimized to improve the subsequent conversion efficiency.
[0094] S32: Combined with the rule hierarchy system, the corresponding parsing fields are determined for conversion rules of different complexities.
[0095] Specifically, when parsing the field, the processing mode of the field is determined according to the rule hierarchy system, the field of the basic conversion layer is directly parsed and stored in the structured data object, the field of the advanced conversion layer needs to further parse the hierarchical information, such as the nesting relationship of the JSON structure, the field of the extended conversion layer needs to adapt to the API change information, such as the change of the field name or the adjustment of the structure, and finally the parsing mode is determined through rule matching, and the field is parsed accordingly.
[0096] S33: Generate a parsing request according to the necessary field and the parsed field, and generate a structured data object according to the parsing request.
[0097] Specifically, the parsing request is dynamically generated according to the API structure and the field mapping relationship, specifies the field path that needs to be parsed, and parses the data layer by layer according to the JSON parsing rule, generates a structured data object after parsing, ensures that the field level is consistent with the mapping relationship, and the data format meets the requirements of JSON Schema, so as to support subsequent conversion.
[0098] In an embodiment, as shown in Figure 6 In step S40, the structured data object is converted according to the rule hierarchy system, and the converted data structure is verified through the JSON Schema rule to generate a converted data structure, specifically including:
[0099] S41: According to the conversion complexity of the structured data object, the corresponding data conversion is performed according to the rule hierarchy system.
[0100] Specifically, the conversion process is executed according to the rule hierarchy system, the field of the basic conversion layer is directly mapped to the target data structure, the field of the advanced conversion layer is adjusted or transformed after the conversion, and the field of the extended conversion layer is adaptively converted according to the API version compatibility rule, such as filling of new fields or adaptation processing of deleted fields, to ensure that the format of the converted data is compatible with the target API.
[0101] S42: Perform data integrity verification combined with the JSON Schema rule, and perform format optimization on the converted data structure according to the target API specification to generate a converted data structure.
[0102] Specifically, after the conversion is completed, the generated data structure is verified by the JSON Schema, including field integrity check, data type consistency check, and hierarchical structure consistency check, to ensure that the data meets the target API specification, such as filling the default value when the field value is empty but is a required field, performing type conversion when the data type is incorrect, and finally optimizing the data format to make the converted data structure meet the API interaction requirements and store it in the data publishing queue.
[0103] It should be understood that the size of the serial number of each step in the above embodiment does not mean the order of execution, and the execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0104] In an embodiment, an application system interface automatic identification and conversion device is provided, which corresponds to the application system interface automatic identification and conversion method in the above embodiment. As shown in the figure, the application system interface automatic identification and conversion device includes a data extraction module, a rule generation module, a data analysis module, and a data conversion and publishing module. The functions of each module are described in detail as follows: Figure 7
[0105] The data extraction module is used to obtain the request data and response data of the API interface, extract the API data structure information based on the request data and response data, and then derive the JSON Schema and generate the field mapping relationship;
[0106] The rule generation module is used to generate data conversion rules using a visual Jolt rule editor according to the field mapping relationship, and establish a rule hierarchy;
[0107] The data analysis module is used to analyze the response data of the API interface, and then extract and standardize the data structure to generate a structured data object;
[0108] The data conversion and publishing module is used to convert the structured data object according to the rule hierarchy, and check the converted data structure through the JSON Schema rule to generate a converted data structure, and then publish the converted data structure.
[0109] Optionally, the data extraction module specifically includes:
[0110] The hierarchical analysis submodule is used to analyze the hierarchical relationship of the request data and response data using a structured analysis method, and identify the nested level of the data structure based on the JSON format analysis rule;
[0111] The pattern matching submodule is used to detect the field name, data type and hierarchical structure of the response data in combination with a pattern matching algorithm, and construct an API data structure information table, and then generate a field mapping relationship.
[0112] Optionally, the rule generation module specifically includes:
[0113] The interactive mapping submodule is used to interactively map the API data structure information according to the Jolt rule editor;
[0114] The rule matching submodule is configured to determine a conversion rule of a corresponding field by matching algorithm based on the field mapping relationship and a preset conversion rule library;
[0115] The rule hierarchical submodule is configured to establish a rule hierarchical system according to the complexity of the conversion rule.
[0116] Optionally, the rule hierarchical submodule specifically comprises:
[0117] The hierarchical division unit is configured to divide the conversion rule into a plurality of hierarchical levels according to a preset complexity threshold according to the complexity of the conversion rule, wherein the hierarchical levels include a basic conversion level, a high-level conversion level and an extended conversion level.
[0118] The basic analysis unit is configured to directly search for a basic field with stable structure by using an index-driven analysis strategy for the basic conversion level.
[0119] The high-level analysis unit is configured to perform hierarchical analysis on nested data by combining JSON structure analysis for the high-level conversion level, and adapt to a complex JSON structure.
[0120] The extended analysis unit is configured to preprocess data with calculation and / or conversion requirements based on a dynamic API structure and by combining a self-defined analysis logic for the extended conversion level.
[0121] Optionally, the data analysis module specifically comprises:
[0122] The field screening submodule is configured to screen necessary fields in the response data based on the field mapping relationship.
[0123] The rule adaptation submodule is configured to determine corresponding analysis fields for conversion rules with different complexities by combining the rule hierarchical system.
[0124] The data construction submodule is configured to generate an analysis request according to the necessary fields and the analysis fields, and generate a structured data object according to the analysis request.
[0125] Optionally, the data conversion and publishing module specifically comprises:
[0126] The conversion execution submodule is configured to perform corresponding data conversion according to the rule hierarchical system according to the conversion complexity of the structured data object.
[0127] The integrity checking submodule is configured to perform data integrity checking by combining a JSON Schema rule, and perform format optimization on a conversion data structure according to a target API specification to generate the conversion data structure.
[0128] The specific limitations of the application system interface automatic identification and conversion device can refer to the limitations of the application system interface automatic identification and conversion method described above, and will not be repeated here. Each module in the application system interface automatic identification and conversion device described above can be realized by software, hardware and their combination in whole or in part. The above-mentioned modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so that the processor calls and executes the operations corresponding to each module.
[0129] In one embodiment, a computer device, which can be a server, is provided, and an internal structure diagram of the computer device can be as shown in Figure 8 The computer device includes a processor, a memory, a network interface and a database connected by a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with external terminals through network connection. The computer program is executed by the processor to implement an application system interface automatic identification and conversion method.
[0130] In one embodiment, a computer device is provided, including a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor implements the following steps when executing the computer program:
[0131] Obtaining request data and response data of the API interface, and extracting API data structure information based on the request data and the response data, and then deriving a JSON Schema and generating a field mapping relationship;
[0132] According to the field mapping relationship, a visual Jolt rule editor is used to generate data conversion rules, and a rule hierarchical system is established;
[0133] Parsing the response data of the API interface, and then extracting and standardizing the data structure to generate a structured data object;
[0134] According to the rule hierarchical system, the structured data object is subjected to data conversion, and the converted data structure is generated by checking the converted data structure through a JSON Schema rule, and then the converted data structure is published.
[0135] In one embodiment, a computer readable storage medium is provided, and a computer program is stored on the computer readable storage medium, and the computer program is executed by the processor to implement the following steps:
[0136] The request data and response data of the API interface are acquired, and API data structure information is extracted based on the request data and the response data, and then a JSON Schema is derived and a field mapping relationship is generated;
[0137] According to the field mapping relationship, a data conversion rule is generated by using a visual Jolt rule editor, and a rule hierarchical system is established;
[0138] The response data of the API interface is parsed, and then a data structure is extracted and standardized, and a structured data object is generated;
[0139] According to the rule hierarchical system, the structured data object is subjected to data conversion, and the converted data structure is generated by checking the converted data structure according to a JSON Schema rule, and then the converted data structure is published.
[0140] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware, and the computer program can be stored in a non-volatile computer readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. In the embodiments provided in the present application, any reference to a memory, storage, database or other medium can include a non-volatile and / or volatile memory. The non-volatile memory can include a read-only memory (ROM), a programmable ROM (PROM), an electrically programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM) or a flash memory. The volatile memory can include a random access memory (RAM) or an external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM) and memory bus dynamic RAM (RDRAM).
[0141] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above.
[0142] The above-described embodiments are only used to illustrate the technical solutions of the present application, but not limit them; although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. An automatic identification and conversion method for application system interface, characterized in that, The method comprises: obtaining request data and response data of an API interface, and extracting API data structure information based on the request data and the response data, and then deriving a JSON Schema and generating a field mapping relationship; The API data structure information is extracted based on the request data and the response data, and then a JSON Schema is derived and a field mapping relationship is generated, specifically comprising: using a structured parsing method to analyze the hierarchical relationship of the request data and the response data, and identifying the nested level of the data structure based on the JSON format parsing rule; combined with the pattern matching algorithm, the field name, data type and hierarchical structure of the response data are detected, and an API data structure information table is constructed, and then the field mapping relationship is generated; According to the field mapping relationship, a data conversion rule is generated by using a visual Jolt rule editor, and a rule hierarchical system is established; According to the field mapping relationship, a data conversion rule is generated by using a visual Jolt rule editor, and a rule hierarchical system is established, specifically comprising: According to the Jolt rule editor, the API data structure information is interactively mapped; According to the field mapping relationship, and based on the preset conversion rule library, the conversion rule of the corresponding field is determined through the matching algorithm; According to the complexity of the conversion rule, the rule hierarchical system is established; The response data of the API interface is parsed, and then the data structure is extracted and standardized to generate a structured data object; According to the rule hierarchical system, the structured data object is converted, and the converted data structure is generated by checking the data structure through the JSON Schema rule, and then the converted data structure is published.
2. The automatic identification and conversion method of application system interface according to claim 1, characterized in that, According to the complexity of the conversion rule, the rule hierarchical system is established, specifically comprising: According to the complexity of the conversion rule, the hierarchical level is divided according to the preset complexity threshold, wherein the hierarchical level includes a basic conversion layer, an advanced conversion layer and an extended conversion layer; For the basic conversion layer, an index-driven parsing strategy is used to directly search for the basic field with stable structure; For the advanced conversion layer, combined with JSON structure analysis, the hierarchical level of nested data is parsed and the complex JSON structure is adapted; For the extended conversion layer, based on the dynamic API structure, combined with the self-defined parsing logic, the data with calculation and / or conversion requirements is preprocessed.
3. The method of claim 1, wherein the application system interface is automatically identified and converted. The response data of the API interface is parsed, and then the data structure is extracted and standardized to generate a structured data object, specifically comprising: Based on the field mapping relationship, the necessary fields in the response data are screened; Combined with the rule hierarchical system, the corresponding parsing field is determined for the conversion rule with different complexity; According to the necessary field and the parsing field, a parsing request is generated, and the structured data object is generated according to the parsing request.
4. The automatic identification and conversion method of application system interface according to claim 1, characterized in that, The structured data object is data-converted according to the rule hierarchical system, and the converted data structure is checked by a JSON Schema rule to generate a converted data structure, specifically including: According to the conversion complexity of the structured data object, corresponding data conversion is performed according to the rule hierarchical system; In combination with the JSON Schema rule, data integrity checking is performed, and the converted data structure is format-optimized according to the target API specification to generate the converted data structure.
5. An automatic identification and conversion device for application system interfaces, characterized in that The device comprises: A data extraction module is configured to obtain request data and response data of an API interface, extract API data structure information based on the request data and the response data, derive a JSON Schema, and generate a field mapping relationship; The data extraction module specifically comprises: A structured parsing method is used to analyze the hierarchical relationship of the request data and the response data, and a JSON format parsing rule is used to identify the nested level of the data structure; In combination with a pattern matching algorithm, the field name, data type, and hierarchical structure of the response data are detected, and an API data structure information table is constructed to generate the field mapping relationship; A rule generation module is configured to generate a data conversion rule using a visual Jolt rule editor according to the field mapping relationship, and establish a rule hierarchical system; The rule generation module specifically comprises: According to the Jolt rule editor, the API data structure information is interactively mapped; According to the field mapping relationship and based on a preset conversion rule library, a matching algorithm is used to determine the conversion rule of the corresponding field; According to the complexity of the conversion rule, the rule hierarchical system is established; A data parsing module is configured to parse the response data of an API interface, and then extract and standardize the data structure to generate a structured data object; A data conversion and publishing module is configured to data-convert the structured data object according to the rule hierarchical system, check the converted data structure by a JSON Schema rule, generate a converted data structure, and then publish the converted data structure.
6. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the application system interface automatic identification and conversion method according to any one of claims 1 to 4.
7. A computer-readable storage medium storing a computer program, wherein the computer program comprises the following steps of: receiving a request for a resource from a client; determining whether the client is authorized to access the resource; and if the client is authorized to access the resource, providing the resource to the client. The computer program is executed by the processor to implement the steps of the application system interface automatic identification and conversion method according to any one of claims 1 to 4.
Citation Information
Patent Citations
JSON (JavaScript Object Notation) data conversion method and device, computer equipment and storage medium
CN112882974A
API request data conversion method and device, electronic equipment and storage medium
CN117615010A