WO2017071341A1 - 一种应用程序编程接口api的分享方法和装置 - Google Patents

一种应用程序编程接口api的分享方法和装置 Download PDF

Info

Publication number
WO2017071341A1
WO2017071341A1 PCT/CN2016/091908 CN2016091908W WO2017071341A1 WO 2017071341 A1 WO2017071341 A1 WO 2017071341A1 CN 2016091908 W CN2016091908 W CN 2016091908W WO 2017071341 A1 WO2017071341 A1 WO 2017071341A1
Authority
WO
WIPO (PCT)
Prior art keywords
api
target
interface
weighted average
apis
Prior art date
Application number
PCT/CN2016/091908
Other languages
English (en)
French (fr)
Inventor
杨沫子
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2017071341A1 publication Critical patent/WO2017071341A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a method and apparatus for sharing an application programming interface API.
  • the API (Application Programming Interface) management platform supports API developers to publish APIs, host API runs, and allow APP developers to order APIs.
  • the API management platform uses WSO2API Manager as an example to introduce the API release and statistical evaluation system in the existing API management platform.
  • the API developer can set the REST_API interface in this interface.
  • the API management platform can provide an interface for the APP developer to score the APIs used according to the usage.
  • the API management platform can be run and counted at runtime. The tools are docked, the usage of the API is counted, and the statistics are displayed, as shown in Figure 3.
  • APIs that implement the same functionality are often encapsulated into different REST_APIs (ie, a set of architectural constraints and principles that satisfy the constraints and principles of application design).
  • REST_APIs a set of architectural constraints and principles that satisfy the constraints and principles of application design.
  • the interface and running logic of these similar functional APIs are different, and these two points determine whether the API can stand out in the same kind of API. How API developers design a good API is an important manifestation of the competitiveness of the API management platform.
  • Embodiments of the present invention provide a sharing method and device for an application programming interface API, which can analyze an excellent API of the same type for an API developer, and push the analysis result to an API developer, thereby enhancing the function of the API management platform.
  • a first aspect of the present invention provides a method for sharing an application programming interface API, including:
  • the network server acquires a statistical condition preset by the target user for the API of the target type, where the statistical condition includes at least one sub-statistic condition, each of the sub-statistic conditions corresponds to one weight, and the target type is calculated according to the statistical condition.
  • a weighted average of each of the APIs in the API determining a reference API from the API of the target type according to the weighted average, acquiring a target API of the same type as the target type developed by the target user, and analyzing
  • the interface and the running logic of the target API and the reference API obtain an analysis result, and the result of the analysis is pushed to the target user.
  • the network server may determine a reference API according to a statistical condition preset by the target user for the target type of API, the reference API is an excellent API in the target type, and then analyze the interface and running logic of the target API and the reference API. And the analysis result is pushed to the target user, so that the target user can optimize the target API according to the analysis result, increase the function of the network server, and enhance the user experience.
  • the network server may determine, as the reference API, an API that has a weighted average of the target type greater than or equal to a recommended indicator, where the recommended indicator is the target user. Pre-set for the API of the target type.
  • the recommended indicator is pre-defined by the target user, and the excellent API screened according to the recommended indicator is more in line with the target user's needs.
  • the network server may sort the APIs of the target type according to the weighted average number in descending order, according to the sorting result, the first N APIs As the reference API, N is equal to a preset threshold.
  • the web server of the same type of API has the advantage of being able to refer to the API of the same type.
  • the network server may determine whether the weighted average of the target API is greater than the reference API. The weighted average of all APIs, if not, the server analyzes the interface and operational logic of the target API and the reference API.
  • the network server may compare the interface of the target API and the reference API, and compare the target API if the interface of the target API and the reference API are the same And the running logic of each interface of the reference API, the running logic The comparison result of the series is taken as the analysis result.
  • the network server extracts from the reference API An interface that is different from the target API performs an association search on the extracted interface to determine a function of the extracted interface, and uses the determined function as the analysis result.
  • the analysis result further includes the extracted running logic of the interface.
  • a second aspect of the present invention provides a sharing device of an application programming interface API, including: a first acquiring module, a calculating module, a screening module, a target API acquiring module, an analyzing module, and a pushing module, wherein the sharing device is executed by using the foregoing module Part or all of the methods of the first aspect.
  • a third aspect of the present invention also provides a computer storage medium storing a program, the program including some or all of the steps of the first aspect.
  • a fourth aspect of the present invention provides a method for sharing an application programming interface API, including:
  • the network server acquires a statistical condition of the API of the target type, where the statistical condition includes at least one sub-statistic condition, each of the sub-statistic conditions corresponds to one weight, and each of the APIs of the target type is calculated according to the statistical condition. Determining a weighted average of the API, determining a reference API from the API of the target type according to the weighted average, determining a target user recommending the reference API, and acquiring a type developed by the target user and the target type.
  • the same target API analyzes the interface and running logic of the target API and the reference API, obtains an analysis result, and pushes the analysis result to the target user.
  • the network server may determine, as the reference API, an API that has a weighted average of the target type greater than or equal to a reference threshold, where the reference threshold is a system. Pre-specified.
  • the network server may sort the APIs of the target type according to the weighted average number in descending order, according to the sorting result, the first N APIs As the reference API, N is equal to a preset threshold.
  • the network server may determine, as the target user, a user subscribed to the target type API Or, the user who uploaded the target type API is determined as the target user.
  • the network server may compare the interface of the target API and the reference API, and compare the target API if the interface of the target API and the reference API are the same And a running logic of each interface of the reference API, and a comparison result of the running logic is used as the analysis result.
  • the network server extracts from the reference API An interface that is different from the target API performs an association search on the extracted interface to determine a function of the extracted interface, and uses the determined function as the analysis result.
  • the analysis result further includes the extracted running logic of the interface.
  • a fifth aspect of the present invention provides a sharing device of an application programming interface API, including a first obtaining module, a calculating module, a screening module, a target API acquiring module, an analyzing module, and a pushing module, where the sharing device performs the first Part or all of the four aspects.
  • a sixth aspect of the present invention also provides a computer storage medium storing a program, the program including some or all of the steps of the first aspect.
  • a seventh aspect of the present invention provides a network server, comprising: a communication interface, a processor, and a memory, wherein the memory stores a set of programs, and the processor is configured to invoke a program stored in the memory,
  • the network server is caused to perform some or all of the methods as in the first aspect, or to perform some or all of the methods as in the fourth aspect.
  • Figure 3 is a statistical diagram of the use of the API in the prior art
  • FIG. 4 is a schematic diagram of an API management system according to an embodiment of the present invention.
  • FIG. 5 is a schematic flowchart of a method for sharing an API according to an embodiment of the present invention.
  • Figure 6 is a schematic illustration of the operational logic recited in the embodiment of Figure 5;
  • FIG. 7 is a schematic flowchart diagram of another API sharing method according to an embodiment of the present invention.
  • FIG. 8 is a schematic structural diagram of an API sharing apparatus according to an embodiment of the present invention.
  • FIG. 9 is a schematic structural view of a screening module in the embodiment shown in FIG. 8;
  • FIG. 10 is a schematic structural diagram of a network server according to an embodiment of the present invention.
  • FIG. 4 is a schematic diagram of an API management system according to an embodiment of the present invention.
  • APP developers need a lot of capabilities to support the operation of the APP, such as SMS function and download function.
  • Each function corresponds to a different API.
  • These functions are sent to the API management platform in the REST_API request format.
  • the API management platform After obtaining the corresponding API, the API management platform forwards the API request to the real server after a certain logical processing. After receiving the request of the API management platform, the server completes the request action and encapsulates the response message.
  • the number of APIs managed by the API management platform is not limited, and the present invention cannot be limited by the number in FIG.
  • the API management platform is a logical concept. Generally, it is deployed as a stand-alone server, combined with other devices in a pure software mode, public cloud deployment, private cloud deployment, hybrid cloud deployment, and the like. At present, the public domain adopts the deployment mode of public cloud and hybrid cloud, and the telecom field adopts the independent server deployment mode.
  • the API management platform can be understood as a network server, and the deployment method of the network server can be adjusted according to actual conditions.
  • the API sharing method provided by the embodiment of the present invention can analyze an excellent API of the same type for the API developer, and push the analysis result to the API developer, thereby assisting the API developer to optimize the API.
  • the API sharing method can analyze an excellent API of the same type for the API developer, and push the analysis result to the API developer, thereby assisting the API developer to optimize the API.
  • FIG. 5 is a schematic diagram of a method for sharing an application programming interface API according to an embodiment of the present invention; as shown in FIG. 5, the method may include:
  • Step S51 Acquire a statistical condition preset by the target user for the API of the target type.
  • An API provider can be understood as a user who provides an API to an API management platform (ie, a web server); a subscription can be understood as focusing on one or some types of APIs.
  • API providers can subscribe to some/some types of APIs and set statistical conditions for their APIs. The statistical conditions include, but are not limited to, the number of calls per unit time (eg, the number of calls per day), the success rate per unit time, the average/variance/mathematical expectation of the delay per unit time, and/or the transmission traffic per unit time. Average/variance/mathematical expectation.
  • the user can select statistical conditions of interest as sub-statistics. Further, the user can also set the weight of each sub-statistic condition.
  • the statistical conditions include the number of calls x per unit time, the success rate m per unit time, and the response speed v.
  • the user can set the weight of x to be 50%, the weight of m to be 30%, and the weight of v to be 20%.
  • the user can adjust the weight of each sub-statistic condition according to actual needs.
  • the API developer can specify the type when developing the API, for example, specified in the API information or specified by the API orchestration.
  • the API management platform uses the specified type as the type of its API; or the API management platform can classify according to the specified type. It can be classified by statistics (no self-learning by the coaching machine, for example, the harmonic mean by the ratio of the upstream and downstream packets, the response entropy value, the content-type, the mathematical expectation of the delay, etc.).
  • the types of APIs can be categorized according to their capabilities, such as instant messaging, vehicle services, weather forecasts, music downloads, and more.
  • Target users can subscribe to multiple types of APIs, and the web server can count each type of target user subscription.
  • the target type is any of the types subscribed to by the target user.
  • the network server may obtain, according to a preset statistical period, a statistical condition preset by the target user for the target type of the API; or, when the network server receives the statistical instruction input by the target user, obtain the target user's API for the target type. Pre-set statistical conditions.
  • Step S52 calculating a weighted average number of each of the APIs in the API of the target type according to the statistical condition.
  • the network server may first calculate the API of the target type according to the statistical condition, and the statistical condition is the number of times of calling in the unit time x, the success rate m in the unit time, and the response
  • the speed v is an example.
  • the statistical result can be exemplified in Table 1.
  • the network server calculates the weighted average of each API according to the weight of each sub-statistic condition. It should be noted that how the network server obtains the statistical results as shown in Table 1 according to the statistical conditions, and how to calculate the weighted average of each API according to the weight of each sub-statistical condition is understandable by those skilled in the art. This will not be repeated here. It should also be noted that Table 1 is only a statistical result and the present invention cannot be limited by the contents of Table 1.
  • Step S53 determining a reference API from the API of the target type according to the weighted average.
  • the network server may obtain a recommendation indicator preset by the target user for the API of the target type, and the network server further compares the weighted average of the target type to or An API equal to the recommended indicator is determined as the reference API.
  • the recommendation index is a standard for measuring excellent API. If the weighted average of the API is greater than or equal to the recommended index, then such API can be considered as an excellent API.
  • the network server may sort the APIs of the target type according to the weighted average number in descending order, according to the sorting result, the first N APIs are used as the Referring to the API, N is equal to the preset threshold.
  • the value of N can be specified by the target user, or it can be set by the network server itself.
  • Step S54 Obtain a target API that is developed by the target user and has the same type as the target type.
  • the target user may submit multiple APIs to the API management platform, and the types of each API may be different.
  • the web server obtains the target API developed by the target user and of the same type as the target type. Comparing the same type of API, the analysis results obtained can better reflect the advantages of the excellent API.
  • step S53 there is no strict sequence of sequential execution between step S53 and step S54, and it may also be performed synchronously, and the present invention is not limited.
  • Step S55 analyzing the interface and running logic of the target API and the reference API, and obtaining an analysis result.
  • the network server may first determine whether the weighted average of the target API is greater than a weighted average of all APIs in the reference API, and if yes, indicate that the target API is the best API of the target type API. Therefore, it is not necessary to analyze and compare the target API with the reference API, and the process ends; otherwise, the interface and the running logic of the target API and the reference API are analyzed to avoid unnecessary computational overhead.
  • the web server can compare and analyze the target API with each reference API in turn, obtain the analysis result, and push each analysis result to the target user.
  • the network server analysis target API is the same as the specific method of each reference API.
  • the embodiment of the present invention compares the target API with one of the reference APIs, and the specific method for comparing and analyzing the target API with other reference APIs. Analogy, I won't go into details here.
  • the network server may compare the interface of the target API and the reference API, and compare the target API and the reference if the interface of the target API and the reference API are the same.
  • Running logic of each interface of the API using a comparison result of the running logic as the analysis result; if the interface of the target API and the reference API are different, extracting the target from the reference API
  • the API has different interfaces, performs an association search on the extracted interface, determines a function of the extracted interface, and uses the determined function as the analysis result.
  • API 2 is the target API
  • API 1 is one of the reference APIs
  • the network server analyzes the northbound interface of API 1, and finds that API 1 has one more parameter.
  • the network server keeps track of the "musicformat" field in API1 running time to the southbound interface, and finds characters such as mp3, wma, wav, etc. String, through the association search, you can find that these strings are all music formats, you can conclude that the function of API 1 is to provide the music format.
  • the web server can use this function as an analysis result to provide an improved direction for the target user.
  • the network server may directly analyze the running logic corresponding to the different interfaces, thereby obtaining the analysis result.
  • the running logic is as shown in FIG. 6, and the analysis can be: Designed for mobile devices, featuring smaller resources for download.
  • the network server can more accurately know the functions of different interfaces by analyzing the running logic, so that the analysis results are more accurate.
  • the network server can use the running logic corresponding to different interfaces as the analysis result.
  • step S56 the analysis result is pushed to the target user.
  • the web server can obtain the contact information provided when the target user registers, and push the analysis result to the target user through the contact method.
  • the contact information includes but is not limited to only Email or SMS.
  • the network server may determine a reference API according to a statistical condition preset by the target user for the API of the target type, the reference API is an excellent API in the target type, and then analyze the target API and the reference API. Interface and running logic, and push the analysis results to the target user, so that the target user can optimize the target API according to the analysis result, and increase the function of the network server.
  • the embodiment shown in FIG. 7 and FIG. 5 is substantially the same.
  • the web server when determining the reference API, the web server starts from the perspective of the needs of each target user, that is, The screening mechanism of each target user's reference API is different.
  • the analysis result obtained by the target user is more accurate and more in line with the improvement direction of each target user.
  • the network server does not determine the reference API. From the perspective of the needs of each target user, that is, the screening mechanism for each target user's reference API is the same, of course, reducing the workload of the network server.
  • FIG. 7 is a schematic diagram of a method for sharing an application programming interface API according to an embodiment of the present invention.
  • the method shown in FIG. 7 may include:
  • Step S71 obtaining a statistical condition of the API of the target type.
  • the API developer can specify its type when developing the API, such as specifying in the API information or API orchestration logic, and the API management platform will specify the type as the type of its API; or, API
  • the management platform can be classified according to the specified type, which can be classified by statistics (no self-learning by the coaching machine, for example, the average of the upper and lower packet lengths, the response entropy value, the resource type (content-type), the delay mathematics) Expectation, etc.).
  • the types of APIs can be categorized according to their capabilities, such as instant messaging, vehicle services, weather forecasts, music downloads, and more.
  • the target type is any one of the types determined by the network server, and the network server is the same for each type of processing flow.
  • the embodiment of the present invention describes only one type of processing flow as an example, and other types of processing. The process is of this type and will not be described here.
  • the statistical conditions include, but are not limited to, the number of calls per unit time (eg, the number of calls per day), the success rate per unit time, the average/variance/mathematical expectation of the delay per unit time, and/or the transmission traffic per unit time. Average/variance/mathematical expectation.
  • the statistical condition is preset by the system and may include a plurality of sub-statistic conditions. Further, each sub-statistic condition corresponds to one weight.
  • the statistical conditions include the number of calls x per unit time, the success rate m per unit time, the response speed v, the weight of x may be 70%, the weight of m may be 30%, and the weight of v may be 20%.
  • the system can adjust the weight of each sub-statistic condition according to actual needs.
  • Step S72 calculating a weighted average number of each of the APIs in the API of the target type according to the statistical condition.
  • the network server may first collect the API of the target type according to the statistical condition.
  • the statistical condition is the number of calls in the unit time x, the success rate m in the unit time, and the response speed v.
  • the statistical result may be Taking Table 1 as an example, for each API in the target type, the network server calculates the weighted average of each API according to the weight of each sub-statistic condition. It should be noted that how the network server obtains the statistical results as shown in Table 1 according to the statistical conditions, and how to calculate the weighted average of each API according to the weight of each sub-statistical condition is understandable by those skilled in the art. This will not be repeated here. It should also be noted that Table 1 is only a statistical result and the present invention cannot be limited by the contents of Table 1.
  • Step S73 determining a reference API from the API of the target type according to the weighted average.
  • the network server may determine, when the statistical condition is obtained, an API whose weighted average number in the target type is greater than or equal to a reference threshold as the reference API, where the reference threshold is The value is pre-specified by the system.
  • the reference threshold is a measure of an excellent API, if If the weighted average of the API is greater than or equal to the reference threshold, then such an API can be considered an excellent API.
  • the network server may sort the APIs of the target type according to the weighted average number in descending order, according to the sorting result, the first N APIs are used as the Referring to the API, N is equal to the preset threshold.
  • the value of N can be specified by the target user, or it can be set by the network server itself.
  • Step S74 determining a target user who recommends the reference API.
  • the network server may determine the user subscribed to the target type API as the target user, that is, only the user who subscribes to the target type API, the network server pushes the analysis result for the network server, thereby reducing the workload of the network server.
  • the web server may determine the user who uploaded the target type API as the target user.
  • Steps S75 to S76 correspond to steps S54 to S56, and are not described herein again.
  • FIG. 8 is a sharing device of an application programming interface API according to an embodiment of the present invention.
  • the sharing device 8 may include at least a first obtaining module 81, a calculating module 82, and a screening module. 83.
  • the second obtaining module 84, the analyzing module 85, and the pushing module 86 wherein:
  • the first obtaining module 81 acquires a statistical condition preset by the target user for the API of the target type, where the statistical condition includes at least one sub-statistic condition, and each of the sub-statistic conditions corresponds to one right.
  • the value calculation module 82 calculates a weighted average number of each of the APIs in the API of the target type according to the statistical condition, and the screening module 83 determines a reference API from the API of the target type according to the weighted average number.
  • the second obtaining module 84 acquires a target API of the same type as the target type developed by the target user, and the analyzing module 85 analyzes the interface and running logic of the target API and the reference API to obtain an analysis result, and the pushing module 86 The analysis result is pushed to the target user.
  • the screening module 83 is specifically configured to:
  • An API that has a weighted average of the target types greater than or equal to a recommendation indicator is determined as the reference API, wherein the recommendation indicator is preset by the target user for an API of the target type.
  • the screening module 83 may include a sorting unit 831 and a screening list as shown in FIG. 9 . a 832, wherein the sorting unit 831 sorts the APIs of the target type according to the order of the weighted averages, and the filtering unit 832 uses the first N APIs as the reference API according to the sorting result. N is equal to the preset threshold.
  • the sharing device 8 may further include a determining module 87, configured to determine whether a weighted average number of the target API is greater than a weighted average of all APIs in the reference API, and if not, triggering the analyzing module 85 The interface and operational logic of the target API and the reference API are analyzed.
  • a determining module 87 configured to determine whether a weighted average number of the target API is greater than a weighted average of all APIs in the reference API, and if not, triggering the analyzing module 85 The interface and operational logic of the target API and the reference API are analyzed.
  • the analyzing module 85 is specifically configured to:
  • the analysis module 85 may further extract an interface different from the target API from the reference API, and perform an association search on the extracted interface. A function of the extracted interface is determined, and the determined function is taken as the analysis result.
  • the analysis result further includes the running logic corresponding to the extracted interface.
  • the first obtaining module 81 acquires a statistical condition of an API of a target type, where the statistical condition includes at least one sub-statistic condition, and each of the sub-statistic conditions corresponds to one weight
  • the calculation module 82 Calculate a weighted average number of each of the APIs in the API of the target type according to the statistical condition
  • the screening module 83 determines a reference API from the API of the target type according to the weighted average
  • the second acquiring module Determining a target user that is recommended to the reference API, and acquiring a target API developed by the target user and having the same type as the target type
  • analyzing module 85 analyzes an interface and operation logic of the target API and the reference API, and obtains As a result of the analysis, the push module 86 pushes the analysis result to the target user.
  • the screening module 83 is specifically configured to:
  • An API that has a weighted average of the target types greater than or equal to a reference threshold is determined as the reference API, the reference threshold being pre-specified by the system.
  • the screening module 83 may include a sorting unit 831 and a filtering unit 832 as shown in FIG. 9, wherein the sorting unit 831 sorts the target type API according to the weighted average number in descending order.
  • the filtering unit 832 uses the first N APIs as the sorting result.
  • the reference API, N is equal to a preset threshold.
  • the pushing module 86 is specifically configured to:
  • a user who uploaded the target type API is determined as the target user.
  • the sharing device 8 may further include a determining module 87, configured to determine whether a weighted average number of the target API is greater than a weighted average of all APIs in the reference API, and if not, triggering the analyzing module 85 The interface and operational logic of the target API and the reference API are analyzed.
  • a determining module 87 configured to determine whether a weighted average number of the target API is greater than a weighted average of all APIs in the reference API, and if not, triggering the analyzing module 85 The interface and operational logic of the target API and the reference API are analyzed.
  • the analyzing module 85 is specifically configured to:
  • the analysis module 85 may further extract an interface different from the target API from the reference API, and perform an association search on the extracted interface. A function of the extracted interface is determined, and the determined function is taken as the analysis result.
  • the analysis result further includes the running logic corresponding to the extracted interface.
  • FIG. 10 is a schematic structural diagram of a network server according to an embodiment of the present invention.
  • the network server 10 may include at least one processor 101, such as a CPU, at least one communication bus 102, a memory 103, a network interface 104, and a power source 105.
  • the structure of the network server shown in the figure does not constitute a limitation of the present invention. It may be a bus-shaped structure or a star structure, and may include more or less than the illustration. Parts, or combine some parts, or different parts.
  • the processor 101 is a control center of the network server that connects various parts of the entire electronic device using various interfaces and lines, by running or executing software programs and/or modules stored in the memory, and calling data stored in the memory, Perform various functions of the web server and/or process data.
  • the processor 101 may be composed of an integrated circuit (IC), for example, may be composed of a single packaged IC, or may be composed of a plurality of packaged ICs having the same function or different functions.
  • the processor 101 may only include a central processing unit (Central Processing Unit, Referred to as CPU), it can also be a combination of GPU and Digital Signal Processor (DSP).
  • CPU Central Processing Unit
  • DSP Digital Signal Processor
  • the CPU may be a single operation core, and may also include multiple operation cores.
  • the memory 103 can be used to store software programs and modules, and the processor 101 executes various functional applications of the web server and implements data processing by running software programs and modules stored in the memory 103.
  • the memory 103 mainly includes a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function, such as a sound playing program, an image playing program, and the like; and the data storage area can be stored according to the electronic device. Use the created data (such as audio data, phone book, etc.).
  • the memory 103 may include a volatile memory, such as a non-volatile volatile random access memory (NVRAM) or a phase change random access memory (PRAM).
  • NVRAM non-volatile volatile random access memory
  • PRAM phase change random access memory
  • MRAM magnetoresistive random access memory
  • non-volatile memory such as at least one disk storage device, electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory) , referred to as EEPROM), flash memory devices, such as NOR flash memory or NAND flash memory.
  • the non-volatile memory stores the operating system executed by the processor.
  • the memory 103 loads the running program and data from the non-volatile memory into the memory and stores the digital content in a plurality of storage devices.
  • the operating system includes various components and/or drivers for controlling and managing conventional system tasks such as memory management, storage device control, power management, and the like, as well as facilitating communication between various hardware and software.
  • the operating system may be an Android system of Google Inc., an iOS system developed by Apple Corporation, a Windows operating system developed by Microsoft Corporation, or an embedded operating system such as Vxworks.
  • Power source 105 is used to power different components of the network server to maintain its operation.
  • the power source 105 includes an external power source that directly supplies power to the network server, such as an AC adapter.
  • the power source may also be more widely defined, and may further include, for example, a power management system, a charging system, a power failure detecting circuit, a power converter or an inverter, and a power status indicator (such as light emitting diodes, as well as any other components associated with the generation, management and distribution of electrical energy of electronic devices.
  • a set of program codes is stored in the memory 103, and the processor The 101 is used to call the program code stored in the memory 103 for performing the following operations:
  • the statistical condition includes at least one sub-statistic condition, each of the sub-statistic conditions corresponding to one weight, and calculating an API of the target type according to the statistical condition a weighted average of each of the APIs, determining a reference API from the API of the target type according to the weighted average, acquiring a target API of the same type as the target type developed by the target user, and analyzing the The interface and the running logic of the target API and the reference API obtain an analysis result and push the analysis result to the target user.
  • a set of program codes is stored in the memory 103, and the processor 101 is configured to call the program code stored in the memory 103 for performing the following operations:
  • Obtaining a statistical condition of an API of a target type the statistical condition including at least one sub-statistic condition, each of the sub-statistic conditions corresponding to a weight, and calculating each of the APIs in the API of the target type according to the statistical condition a weighted average, determining a reference API from the API of the target type according to the weighted average, determining a target user recommending the reference API, and acquiring the same type of the target type developed by the target user
  • the target API analyzes the interface and the running logic of the target API and the reference API, obtains an analysis result, and pushes the analysis result to the target user.
  • the functions of the function modules of the network server 10 can be specifically implemented according to the method in the method embodiment shown in FIG. 7, and may be specifically related to the related description in FIG. 7, and details are not described herein again.
  • modules or units in the device of the embodiment of the present invention may be merged, divided, and deleted according to actual needs. Less.
  • the module or unit in the embodiment of the present invention may be implemented by a general-purpose integrated circuit, such as a CPU (Central Processing Unit) or an ASIC (Application Specific Integrated Circuit).
  • a general-purpose integrated circuit such as a CPU (Central Processing Unit) or an ASIC (Application Specific Integrated Circuit).
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephonic Communication Services (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

一种应用程序编程接口API的分享方法,网络服务器获取目标用户针对目标类型的API预先设置的统计条件,根据统计条件计算目标类型的API中每个API的加权平均数,根据加权平均数从目标类型的API中确定出参考API,获取目标用户开发的与目标类型相同类型的目标API,分析目标API和参考API的接口和运行逻辑,获得分析结果,将分析结果推送给目标用户,可以为API开发者分析出优秀的同类API,并将分析结果推送给API开发者,增强了API管理平台的功能。

Description

一种应用程序编程接口API的分享方法和装置
本申请要求于2015年10月28日提交中国专利局,申请号为201510714189.5、发明名称为“一种应用程序编程接口API的分享方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及计算机技术领域,尤其涉及一种应用程序编程接口API的分享方法和装置。
背景技术
API(Application Programming Interface,应用程序编程接口)管理平台支持API开发者发布API,并托管API的运行,以及允许APP开发者订购API。为了便于理解,API管理平台以WSO2API Manager为例,介绍现有API管理平台中API发布以及统计评价系统。如图1所述,API开发者可以在这个界面设置REST_API的接口。如图2所示,APP开发者在订购某个API后,API管理平台可以提供一个界面让APP开发者根据使用情况对其使用的API进行评分;此时,API管理平台在运行时可以和统计工具进行对接,统计出API的使用情况,并显示统计图,如图3所示。
在API管理平台上,不同的API开发者经常会将相同能力(即实现同一功能的API)封装为不同的REST_API(即一组架构约束条件和原则,满足约束条件和原则的应用程序设计),这些同类功能API的接口和运行逻辑均不相同,而这两点决定了API是否能在同类的API中脱颖而出。如何API开发者设计一个良好的API是API管理平台竞争力的重要体现。
发明内容
本发明实施例提供一种应用程序编程接口API的分享方法和装置,可以为API开发者分析出优秀的同类API,并将分析结果推送给API开发者,从而增强API管理平台的功能。
本发明第一方面提供了一种应用程序编程接口API的分享方法,包括:
网络服务器获取目标用户针对目标类型的API预先设置的统计条件,所述统计条件包括至少一个子统计条件,每个所述子统计条件对应一个权值,根据所述统计条件计算所述目标类型的API中每个所述API的加权平均数,根据所述加权平均数从所述目标类型的API中确定出参考API,获取所述目标用户开发的与所述目标类型相同类型的目标API,分析所述目标API和所述参考API的接口和运行逻辑,获得分析结果,将所述分析结果推送给所述目标用户。
在该技术方案中,网络服务器可以根据目标用户针对目标类型的API预先设置的统计条件确定参考API,参考API是所述目标类型中优秀的API,再分析目标API和参考API的接口和运行逻辑,并将分析结果推送给目标用户,使得目标用户可以根据其分析结果优化目标API,增加了网络服务器的功能,增强了用户体验。
在第一方面的第一种可能的实现方式中,网络服务器可以将所述目标类型中加权平均数大于或等于推荐指标的API确定为所述参考API,其中所述推荐指标是所述目标用户针对所述目标类型的API预先设置的。
在该技术方案中,推荐指标是目标用户预先制定的,那么根据该推荐指标筛选出的优秀API更符合目标用户的需求。
在第一方面的第二种可能的实现方式中,网络服务器可以根据所述加权平均数由大到小的顺序对所述目标类型的API进行排序,根据所述排序结果,将前N个API作为所述参考API,N等于预设阈值。
在该技术方案中,网络服务器不管目标用户设置的推荐指标,针对同一类型的API,排序靠前的API相比其余的API,总有优点可以参考。
结合第一方面的第一种至第二种中任一种可能的实现方式,在第三种可能的实现方式中,网络服务器可以判断所述目标API的加权平均数是否大于所述参考API中所有API的加权平均数,若否,服务器才分析所述目标API和所述参考API的接口和运行逻辑。
在第一方面的第四种可能的实现方式中,网络服务器可以比较所述目标API和所述参考API的接口,若所述目标API和所述参考API的接口相同,则比较所述目标API和所述参考API的每个接口的运行逻辑,将所述运行逻 辑的比较结果作为所述分析结果。
结合第一方面的第四种可能的实现方式中,在第五种可能的实现方式中,若所述目标API和所述参考API的接口不相同,网络服务器则从所述参考API中提取与所述目标API不同的接口,对提取到的所述接口进行关联搜索,以确定提取到的所述接口的功能,并将确定的所述功能作为所述分析结果。
结合第一方面的第五种可能的实现方式中,在第六种可能的实现方式中,所述分析结果还包括提取到的所述接口对应的运行逻辑。
本发明第二方面提供了一种应用程序编程接口API的分享装置,包括:第一获取模块、计算模块、筛选模块、目标API获取模块、分析模块以及推送模块,所述分享装置通过上述模块执行第一方面的部分或全部方法。
本发明第三方面还提供了一种计算机存储介质,所述计算机存储介质存储有程序,所述程序执行时包括第一方面的部分或全部步骤。
本发明第四方面还提供了一种应用程序编程接口API的分享方法,包括:
网络服务器获取目标类型的API的统计条件,所述统计条件包括至少一个子统计条件,每个所述子统计条件对应一个权值,根据所述统计条件计算所述目标类型的API中每个所述API的加权平均数,根据所述加权平均数从所述目标类型的API中确定出参考API,确定推荐所述参考API的目标用户,并获取所述目标用户开发的类型与所述目标类型相同的目标API,分析所述目标API和所述参考API的接口和运行逻辑,获得分析结果,将所述分析结果推送给所述目标用户。
在第四方面的第一种可能的实现方式中,网络服务器可以将所述目标类型中加权平均数大于或等于参考门限值的API确定为所述参考API,所述参考门限值是系统预先指定的。
在第四方面的第二种可能的实现方式中,网络服务器可以根据所述加权平均数由大到小的顺序对所述目标类型的API进行排序,根据所述排序结果,将前N个API作为所述参考API,N等于预设阈值。
结合第四方面的第一种至第二种中任一种可能的实现方式,在第三种可能的实现方式中,网络服务器可以将订阅了所述目标类型API的用户确定为所述目标用户,或者,将上传了所述目标类型API的用户确定为所述目标用户。
在第四方面的第四种可能的实现方式中,网络服务器可以比较所述目标API和所述参考API的接口,若所述目标API和所述参考API的接口相同,则比较所述目标API和所述参考API的每个接口的运行逻辑,将所述运行逻辑的比较结果作为所述分析结果。
结合第四方面的第四种可能的实现方式中,在第五种可能的实现方式中,若所述目标API和所述参考API的接口不相同,网络服务器则从所述参考API中提取与所述目标API不同的接口,对提取到的所述接口进行关联搜索,以确定提取到的所述接口的功能,并将确定的所述功能作为所述分析结果。
结合第四方面的第五种可能的实现方式中,在第六种可能的实现方式中,所述分析结果还包括提取到的所述接口对应的运行逻辑。
本发明第五方面提供了一种应用程序编程接口API的分享装置,包括第一获取模块、计算模块、筛选模块、目标API获取模块、分析模块以及推送模块,所述分享装置通过上述模块执行第四方面的部分或全部方法。
本发明第六方面还提供了一种计算机存储介质,所述计算机存储介质存储有程序,所述程序执行时包括第一方面的部分或全部步骤。
本发明第七方面还提供了一种网络服务器,所述网络服务器包括通信接口、处理器和存储器,其中,所述存储器中存储一组程序,且处理器用于调用所述存储器中存储的程序,使得所述网络服务器执行如第一方面的部分或全部方法,或执行如第四方面的部分或全部方法。
附图说明
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是现有技术中API管理平台的发布界面;
图2是现有技术中API管理平台的评价界面;
图3是现有技术中API使用情况的统计图;
图4是本发明实施例提供的API管理系统的示意图;
图5是本发明实施例提供的一种API的分享方法的流程示意图;
图6是图5所示的实施例中列举的运行逻辑的示意图;
图7是本发明实施例提供的另一种API的分享方法的流程示意图;
图8是本发明实施例提供的一种API的分享装置的结构示意图;
图9是图8所示实施例中筛选模块的结构示意图;
图10是本发明实施例提供的一种网络服务器的结构示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
在此部分,首先对本发明各个实施例中均涉及的一些基本概念进行说明。
图4是本发明实施例提供的API管理系统的示意图。如图4所示,APP开发者在开发APP时,需要许多能力来支撑APP的运行,例如短信功能、下载功能,各个功能对应不同的API,这些功能均以REST_API的请求格式发送给API管理平台,API管理平台在获取到相应的API后,经过一定的逻辑处理,将API请求转发给真正的Server,Server在接收到API管理平台的请求后,完成请求的动作,并封装响应报文返回。需要说明的是,在实际应用中,API管理平台管理的API的数量不限定,不能以图4中的数量限制本发明。
其中,API管理平台是一个逻辑概念,一般情况下以独立服务器部署、以纯软件方式与其他设备合设、公有云部署、私有云部署、混合云部署等。目前IT领域多采用公有云和混合云部署方式,电信领域多采用独立服务器部署方式。总的来说,API管理平台可以理解为网络服务器,至于网络服务器的部署方式可以根据实际情况调整。
本发明实施例提供的API的分享方法,可以为API开发者分析出优秀的同类API,并将分析结果推送给API开发者,从而辅助API开发者优化自身API。详细描述请参照图5-图6对应的实施例。
请参阅图5,图5是本发明实施例提供的一种应用程序编程接口API的分享方法的示意图;如图5所示所述方法可以包括:
步骤S51,获取目标用户针对目标类型的API预先设置的统计条件。
目标用户API提供者中订阅了API的任一API提供者。API提供者可以理解为向API管理平台(即网络服务器)提供了API的用户;订阅可以理解为关注某一/些类型的API。API提供者可以订阅某一/些类型的API,并设置其API的统计条件。所述统计条件包括但不仅仅局限于单位时间内调用次数(例如每天调用次数)、单位时间内成功率、单位时间内时延的平均/方差/数学期望和/或单位时间内的传输流量的平均/方差/数学期望。
用户在订阅API时,可以选择感兴趣的统计条件作为子统计条件。进一步的,用户还可以设置每个子统计条件的权值。例如,统计条件包括单位时间内调用次数x,单位时间内成功率m,响应速度v,用户可以设置x的权值为50%、m的权值为30%,v的权值为20%。当然,用户可以根据实际需求调整每个子统计条件的权值。
API开发者在开发API时可以指定其类型,例如在API信息中指定或者API编排逻辑指定,API管理平台将指定的类型作为其API的类型;或者,API管理平台可以根据指定的类型进行分类,可以是通过统计分类(无教练机器自学习,例如通过上下行包长比例的调和平均数、响应熵值、资源类型(content-type)、时延的数学期望等)。可选的,API的类型可以根据其功能进行分类,例如:即时通讯、车辆服务、天气预报、音乐下载等等。
目标用户可以订阅多个类型的API,网络服务器可以对目标用户订阅的每种类型都进行统计。目标类型为目标用户订阅的类型中的任一种类型。
可选的,网络服务器可以根据预先设置的统计周期获取目标用户针对目标类型的API预先设置的统计条件;或者,当网络服务器接收到目标用户输入的统计指令时,获取目标用户针对目标类型的API预先设置的统计条件。
步骤S52,根据所述统计条件计算所述目标类型的API中每个所述API的加权平均数。
网络服务器当获取到统计条件时,可以先根据所述统计条件统计目标类型的API,所述统计条件以单位时间内调用次数x,单位时间内成功率m,响应 速度v为例,统计结果可以以表1为例,针对目标类型中的每一个API,网络服务器再根据每个子统计条件的权值,计算每个API的加权平均数。应指出的是,网络服务器如何根据统计条件获取如表1所示的统计结果,以及如何根据每个子统计条件的权值计算每个API的加权平均数,是本领域技术人员可理解的,在此不再赘述。还应指出的是,表1只是一种统计结果,不能以表1中内容限制本发明。
表1
API 统计次数 成功率 响应速度(ms)
API1 100 97% 300
API2 80 95% 250
API3 75 92% 320
API4 46 89% 400
API5 40 86% 340
API6 33 83% 330
API7 30 80% 230
API8 20 77% 210
API9 15 74% 320
API10 10 71% 340
步骤S53,根据所述加权平均数从所述目标类型的API中确定出参考API。
在一种可选的实施方式中,网络服务器当获取到统计条件时,可以获取目标用户针对所述目标类型的API预先设置的推荐指标,网络服务器再将所述目标类型中加权平均数大于或等于所述推荐指标的API确定为所述参考API。其中,推荐指标是衡量优秀API的一个标准,若API的加权平均数大于或等于所述推荐指标,则可以认为这类API为优秀API。
在另一种可选的实施方式中,网络服务器可以根据所述加权平均数由大到小的顺序对所述目标类型的API进行排序,根据所述排序结果,将前N个API作为所述参考API,N等于预设阈值。其中N的值可以是目标用户指定的,也可以是网络服务器自行设置的。
步骤S54,获取所述目标用户开发的类型与所述目标类型相同的目标API。
目标用户可能向API管理平台提交了多个API,每个API的类型可能不同,网络服务器获取目标用户开发的和所述目标类型相同类型的目标API。将同一类型的API进行比较,获得的分析结果才更能体现优秀API的优点。
需要说明的是,步骤S53和步骤S54之间没有严格的先后执行顺序,还可以同步执行,本发明不限定。
步骤S55,分析所述目标API和所述参考API的接口和运行逻辑,获得分析结果。可选的,网络服务器可以先判断所述目标API的加权平均数是否大于所述参考API中所有API的加权平均数,若是,说明所述目标API是所述目标类型的API中最优秀的API,就没有必要再将所述目标API与参考API进行分析比较,则结束本流程;否则,才分析所述目标API和所述参考API的接口和运行逻辑,以此避免不必要的运算开销。
网络服务器可以将目标API依次与各个参考API进行比较分析,获得分析结果,并将各个分析结果推送给目标用户。应指出的是,网络服务器分析目标API与各个参考API的具体方法相同,本发明实施例以目标API与其中一个参考API进行比较为例,目标API与其他参考API进行比较分析的具体方法以此类推,在此不再赘述。
在一种可选的实施方式中,网络服务器可以比较所述目标API和所述参考API的接口,若所述目标API和所述参考API的接口相同,则比较所述目标API和所述参考API的每个接口的运行逻辑,将所述运行逻辑的比较结果作为所述分析结果;若所述目标API和所述参考API的接口不相同,则从所述参考API中提取与所述目标API不同的接口,对提取到的所述接口进行关联搜索,以确定提取到的所述接口的功能,并将确定的所述功能作为所述分析结果。
假设,API 2为目标API,API 1为其中一个参考API,API 1的接口为:Get/musicdownload1?musicname={}&&musicformat={},API 2的接口为:Get/musicdownload2?song={},网络服务器分析API 1的北向接口,发现API 1多了一个参数,网络服务器跟踪API 1运行时刻填充到南向接口中的“musicformat”字段,发现为mp3,wma,wav等字符串,通过关联搜索,可以发现这些字符串均为音乐格式,可以得出API 1的功能是提供音乐格式的选 择,网络服务器可以将这个功能作为分析结果,为目标用户提供改进的方向。
进一步的,网络服务器若发现目标API和参考API的接口不同,可以直接分析不同的接口对应的运行逻辑,从而获得分析结果,假设,运行逻辑如图6所示,通过分析可以得出:该功能是为移动终端设计的,特点是选取较小的资源以供下载。网络服务器通过分析运行逻辑可以更准确的获知不同的接口的功能,使得分析结果更准确。
再进一步的,网络服务器可以将不同的接口对应的运行逻辑作为分析结果。
步骤S56,将所述分析结果推送给所述目标用户。
网络服务器可以获取目标用户注册时提供的联系方式,通过所述联系方式将分析结果推送给目标用户。需要说明的是,所述联系方式包括但不仅仅局限于Email或SMS。
在图5所示的实施例中,网络服务器可以根据目标用户针对目标类型的API预先设置的统计条件确定参考API,参考API是所述目标类型中优秀的API,再分析目标API和参考API的接口和运行逻辑,并将分析结果推送给目标用户,使得目标用户可以根据其分析结果优化目标API,增加了网络服务器的功能。
图7和图5所示的实施例大致相同,区别在于:图5所示的实施例中,网络服务器在确定参考API时,是从每个目标用户的需求角度出发的,也就是说,针对每个目标用户的参考API的筛选机制不同,当然,其获得的分析结果更准确,更符合各个目标用户的改进方向;而图7所示的实施例中,网络服务器在确定参考API时,不是从每个目标用户的需求角度出发的,也就是说,针对每个目标用户的参考API的筛选机制相同,当然,降低了网络服务器的工作量。
请参阅图7,图7是本发明实施例提供的一种应用程序编程接口API的分享方法的示意图;如图7所示所述方法可以包括:
步骤S71,获取目标类型的API的统计条件。
API开发者在开发API时可以指定其类型,例如在API信息中指定或者API编排逻辑指定,API管理平台将指定的类型作为其API的类型;或者,API 管理平台可以根据指定的类型进行分类,可以是通过统计分类(无教练机器自学习,例如通过上下行包长比例的调和平均数、响应熵值、资源类型(content-type)、时延的数学期望等)。可选的,API的类型可以根据其功能进行分类,例如:即时通讯、车辆服务、天气预报、音乐下载等等。
所述目标类型为网络服务器确定的类型中的任一种类型,网络服务器针对每一种类型的处理流程相同,本发明实施例只描述了其中一种类型为例的处理流程,其他类型的处理流程以此类型,在此不再赘述。
所述统计条件包括但不仅仅局限于单位时间内调用次数(例如每天调用次数)、单位时间内成功率、单位时间内时延的平均/方差/数学期望和/或单位时间内的传输流量的平均/方差/数学期望。
所述统计条件时系统预先设置的,可以包括多个子统计条件。进一步的,每个子统计条件对应一个权值。例如,统计条件包括单位时间内调用次数x,单位时间内成功率m,响应速度v,x的权值可以为70%、m的权值可以为30%,v的权值可以为20%。当然,系统可以根据实际需求调整每个子统计条件的权值。
步骤S72,根据所述统计条件计算所述目标类型的API中每个所述API的加权平均数。
网络服务器当获取到统计条件时,可以先根据所述统计条件统计目标类型的API,所述统计条件以单位时间内调用次数x,单位时间内成功率m,响应速度v为例,统计结果可以以表1为例,针对目标类型中的每一个API,网络服务器再根据每个子统计条件的权值,计算每个API的加权平均数。应指出的是,网络服务器如何根据统计条件获取如表1所示的统计结果,以及如何根据每个子统计条件的权值计算每个API的加权平均数,是本领域技术人员可理解的,在此不再赘述。还应指出的是,表1只是一种统计结果,不能以表1中内容限制本发明。
步骤S73,根据所述加权平均数从所述目标类型的API中确定出参考API。
在一种可选的实施方式中,网络服务器当获取到统计条件时,可以将所述目标类型中加权平均数大于或等于参考门限值的API确定为所述参考API,所述参考门限值是系统预先指定的。参考门限值是衡量优秀API的一个标准,若 API的加权平均数大于或等于所述参考门限值,则可以认为这类API为优秀API。
在另一种可选的实施方式中,网络服务器可以根据所述加权平均数由大到小的顺序对所述目标类型的API进行排序,根据所述排序结果,将前N个API作为所述参考API,N等于预设阈值。其中N的值可以是目标用户指定的,也可以是网络服务器自行设置的。
步骤S74,确定推荐所述参考API的目标用户。
网络服务器可以将订阅了所述目标类型API的用户确定为所述目标用户,也就是说,只有订阅了目标类型API的用户,网络服务器才为其推送分析结果,减小了网络服务器的工作量;或者,网络服务器可以将上传了所述目标类型API的用户确定为所述目标用户。
其中,步骤S75~S76与步骤S54~S56对应,在此不再赘述。
请参阅图8,图8是本发明实施例提供的一种应用程序编程接口API的分享装置;如图8所示所述分享装置8至少可以包括第一获取模块81、计算模块82、筛选模块83、第二获取模块84、分析模块85以及推送模块86,其中:
在一种可选的实施方式中,第一获取模块81获取目标用户针对目标类型的API预先设置的统计条件,所述统计条件包括至少一个子统计条件,每个所述子统计条件对应一个权值,计算模块82根据所述统计条件计算所述目标类型的API中每个所述API的加权平均数,筛选模块83根据所述加权平均数从所述目标类型的API中确定出参考API,第二获取模块84获取所述目标用户开发的与所述目标类型相同类型的目标API,分析模块85分析所述目标API和所述参考API的接口和运行逻辑,获得分析结果,推送模块86将所述分析结果推送给所述目标用户。
可选的,所述筛选模块83具体用于:
将所述目标类型中加权平均数大于或等于推荐指标的API确定为所述参考API,其中所述推荐指标是所述目标用户针对所述目标类型的API预先设置的。
可选的,所述筛选模块83如图9所示可以包括排序单元831以及筛选单 元832,其中,排序单元831根据所述加权平均数由大到小的顺序对所述目标类型的API进行排序,筛选单元832根据所述排序结果,将前N个API作为所述参考API,N等于预设阈值。
进一步的,所述分享装置8还可以包括判断模块87,用于判断所述目标API的加权平均数是否大于所述参考API中所有API的加权平均数,若否,则触发所述分析模块85分析所述目标API和所述参考API的接口和运行逻辑。
可选的,所述分析模块85具体用于:
比较所述目标API和所述参考API的接口,若所述目标API和所述参考API的接口相同,则比较所述目标API和所述参考API的每个接口的运行逻辑,将所述运行逻辑的比较结果作为所述分析结果。
若所述目标API和所述参考API的接口不相同,所述分析模块85具体还可以从所述参考API中提取与所述目标API不同的接口,对提取到的所述接口进行关联搜索,以确定提取到的所述接口的功能,并将确定的所述功能作为所述分析结果。
其中,所述分析结果还包括提取到的所述接口对应的运行逻辑。
在另一种可选的实施方式中,第一获取模块81获取目标类型的API的统计条件,所述统计条件包括至少一个子统计条件,每个所述子统计条件对应一个权值,计算模块82根据所述统计条件计算所述目标类型的API中每个所述API的加权平均数,筛选模块83根据所述加权平均数从所述目标类型的API中确定出参考API,第二获取模块84确定推荐所述参考API的目标用户,并获取所述目标用户开发的类型与所述目标类型相同的目标API,分析模块85分析所述目标API和所述参考API的接口和运行逻辑,获得分析结果,推送模块86将所述分析结果推送给所述目标用户。
可选的,所述筛选模块83具体用于:
将所述目标类型中加权平均数大于或等于参考门限值的API确定为所述参考API,所述参考门限值是系统预先指定的。
可选的,所述筛选模块83如图9所示可以包括排序单元831以及筛选单元832,其中,排序单元831根据所述加权平均数由大到小的顺序对所述目标类型的API进行排序,筛选单元832根据所述排序结果,将前N个API作为 所述参考API,N等于预设阈值。
可选的,所述推送模块86具体可以用于:
将订阅了所述目标类型API的用户确定为所述目标用户;或者,
将上传了所述目标类型API的用户确定为所述目标用户。
进一步的,所述分享装置8还可以包括判断模块87,用于判断所述目标API的加权平均数是否大于所述参考API中所有API的加权平均数,若否,则触发所述分析模块85分析所述目标API和所述参考API的接口和运行逻辑。
可选的,所述分析模块85具体用于:
比较所述目标API和所述参考API的接口,若所述目标API和所述参考API的接口相同,则比较所述目标API和所述参考API的每个接口的运行逻辑,将所述运行逻辑的比较结果作为所述分析结果。
若所述目标API和所述参考API的接口不相同,所述分析模块85具体还可以从所述参考API中提取与所述目标API不同的接口,对提取到的所述接口进行关联搜索,以确定提取到的所述接口的功能,并将确定的所述功能作为所述分析结果。
其中,所述分析结果还包括提取到的所述接口对应的运行逻辑。
请参阅图10,图10是本发明实施例提供的一种网络服务器的结构示意图。如图10所示,所述网络服务器10可以包括:至少一个处理器101,例如CPU,至少一个通信总线102、存储器103、网络接口104、电源105。
本领域技术人员可以理解,图中示出的网络服务器的结构并不构成对本发明的限定,它既可以是总线形结构,也可以是星型结构,还可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
处理器101为网络服务器的控制中心,利用各种接口和线路连接整个电子设备的各个部分,通过运行或执行存储在存储器内的软件程序和/或模块,以及调用存储在存储器内的数据,以执行网络服务器的各种功能和/或处理数据。所述处理器101可以由集成电路(Integrated Circuit,简称IC)组成,例如可以由单颗封装的IC所组成,也可以由连接多颗相同功能或不同功能的封装IC而组成。举例来说,处理器101可以仅包括中央处理器(Central Processing Unit, 简称CPU),也可以是GPU、数字信号处理器(Digital Signal Processor,简称DSP)的组合。在本发明实施方式中,CPU可以是单运算核心,也可以包括多运算核心。
存储器103可用于存储软件程序以及模块,处理器101通过运行存储在存储器103的软件程序以及模块,从而执行网络服务器的各种功能应用以及实现数据处理。存储器103主要包括程序存储区和数据存储区,其中,程序存储区可存储操作系统、至少一个功能所需的应用程序,比如声音播放程序、图像播放程序等等;数据存储区可存储根据电子设备的使用所创建的数据(比如音频数据、电话本等)等。在本发明具体实施方式中,存储器103可以包括易失性存储器,例如非挥发性动态随机存取内存(Nonvolatile Random Access Memory,简称NVRAM)、相变化随机存取内存(Phase Change RAM,简称PRAM)、磁阻式随机存取内存(Magetoresistive RAM,简称MRAM)等,还可以包括非易失性存储器,例如至少一个磁盘存储器件、电子可擦除可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,简称EEPROM)、闪存器件,例如反或闪存(NOR flash memory)或是反及闪存(NAND flash memory)。非易失存储器储存处理器所执行的操作系统。存储器103从所述非易失存储器加载运行程序与数据到内存并将数字内容储存于大量储存装置中。所述操作系统包括用于控制和管理常规系统任务,例如内存管理、存储设备控制、电源管理等,以及有助于各种软硬件之间通信的各种组件和/或驱动器。在本发明实施方式中,所述操作系统可以是Google公司的Android系统、Apple公司开发的iOS系统或Microsoft公司开发的Windows操作系统等,或者是Vxworks这类的嵌入式操作系统。
电源105用于给网络服务器的不同部件进行供电以维持其运行。作为一般性理解,电源105括直接向网络服务器供电的外接电源,例如AC适配器等。在本发明的一些实施方式中,所述电源还可以作更为广泛的定义,例如还可以包括电源管理系统、充电系统、电源故障检测电路、电源转换器或逆变器、电源状态指示器(如发光二极管),以及与电子设备的电能生成、管理及分布相关联的其他任何组件。
在一种可选的实施方式中,存储器103中存储一组程序代码,且处理器 101用于调用存储器103中存储的程序代码,用于执行以下操作:
获取目标用户针对目标类型的API预先设置的统计条件,所述统计条件包括至少一个子统计条件,每个所述子统计条件对应一个权值,根据所述统计条件计算所述目标类型的API中每个所述API的加权平均数,根据所述加权平均数从所述目标类型的API中确定出参考API,获取所述目标用户开发的与所述目标类型相同类型的目标API,分析所述目标API和所述参考API的接口和运行逻辑,获得分析结果,将所述分析结果推送给所述目标用户。
可理解的是,本该实现方式中,网络服务器10的各功能模块的功能可根据图5所示方法实施例中的方法具体实现,可以具体对应图5的相关描述,此处不再赘述。
在另一种可选的实施方式中,存储器103中存储一组程序代码,且处理器101用于调用存储器103中存储的程序代码,用于执行以下操作:
获取目标类型的API的统计条件,所述统计条件包括至少一个子统计条件,每个所述子统计条件对应一个权值,根据所述统计条件计算所述目标类型的API中每个所述API的加权平均数,根据所述加权平均数从所述目标类型的API中确定出参考API,确定推荐所述参考API的目标用户,并获取所述目标用户开发的与所述目标类型相同类型的目标API,分析所述目标API和所述参考API的接口和运行逻辑,获得分析结果,将所述分析结果推送给所述目标用户。
可理解的是,本该实现方式中,网络服务器10的各功能模块的功能可根据图7所示方法实施例中的方法具体实现,可以具体对应图7的相关描述,此处不再赘述。
需要说明的是,在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详细描述的部分,可以参见其他实施例的相关描述。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本发明实施例所必须的。
本发明实施例方法中的步骤可以根据实际需要进行顺序调整、合并和删减。
本发明实施例装置中的模块或单元可以根据实际需要进行合并、划分和删 减。
本发明实施例中所述模块或单元,可以通过通用集成电路,例如CPU(Central Processing Unit,中央处理器),或通过ASIC(Application Specific Integrated Circuit,专用集成电路)来实现。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。
以上所揭露的仅为本发明较佳实施例而已,当然不能以此来限定本发明之权利范围,因此依本发明权利要求所作的等同变化,仍属本发明所涵盖的范围。

Claims (22)

  1. 一种应用程序编程接口API的分享方法,其特征在于,包括:
    获取目标用户针对目标类型的API预先设置的统计条件,所述统计条件包括至少一个子统计条件,每个所述子统计条件对应一个权值;
    根据所述统计条件计算所述目标类型的API中每个所述API的加权平均数;
    根据所述加权平均数从所述目标类型的API中确定出参考API;
    获取所述目标用户开发的与所述目标类型相同类型的目标API;
    分析所述目标API和所述参考API的接口和运行逻辑,获得分析结果;
    将所述分析结果推送给所述目标用户。
  2. 如权利要求1所述的方法,其特征在于,
    所述根据所述加权平均数从所述目标类型的API中确定出参考API包括:
    将所述目标类型中加权平均数大于或等于推荐指标的API确定为所述参考API,其中所述推荐指标是所述目标用户针对所述目标类型的API预先设置的。
  3. 如权利要求1所述的方法,其特征在于,
    所述根据所述加权平均数从所述目标类型的API中确定出参考API包括:
    根据所述加权平均数由大到小的顺序对所述目标类型的API进行排序;
    根据所述排序结果,将前N个API作为所述参考API,N等于预设阈值。
  4. 如权利要求1-3中任一项所述的方法,其特征在于,所述分析所述目标API和所述参考API的接口和运行逻辑,获得分析结果之前,所述方法还包括:
    判断所述目标API的加权平均数是否大于所述参考API中所有API的加权平均数;
    若否,则执行所述分析所述目标API和所述参考API的接口和运行逻辑 的步骤。
  5. 如权利要求1所述的方法,其特征在于,所述分析所述目标API和所述参考API的接口和运行逻辑,获得分析结果包括:
    比较所述目标API和所述参考API的接口;
    若所述目标API和所述参考API的接口相同,则比较所述目标API和所述参考API的每个接口的运行逻辑,将所述运行逻辑的比较结果作为所述分析结果。
  6. 如权利要求5所述的方法,其特征在于,所述方法还包括:
    若所述目标API和所述参考API的接口不相同,则从所述参考API中提取与所述目标API不同的接口;
    对提取到的所述接口进行关联搜索,以确定提取到的所述接口的功能,并将确定的所述功能作为所述分析结果。
  7. 如权利要求6所述的方法,其特征在于,
    所述分析结果还包括提取到的所述接口对应的运行逻辑。
  8. 一种应用程序编程接口API的分享装置,其特征在于,包括:
    第一获取模块,用于获取目标用户针对目标类型的API预先设置的统计条件,所述统计条件包括至少一个子统计条件,每个所述子统计条件对应一个权值;
    计算模块,用于根据所述统计条件计算所述目标类型的API中每个所述API的加权平均数;
    筛选模块,用于根据所述加权平均数从所述目标类型的API中确定出参考API;
    第二获取模块,用于获取所述目标用户开发的与所述目标类型相同类型的目标API;
    分析模块,用于分析所述目标API和所述参考API的接口和运行逻辑, 获得分析结果;
    推送模块,用于将所述分析结果推送给所述目标用户。
  9. 如权利要求8所述的装置,其特征在于,所述筛选模块具体用于:
    将所述目标类型中加权平均数大于或等于推荐指标的API确定为所述参考API,其中所述推荐指标是所述目标用户针对所述目标类型的API预先设置的。
  10. 如权利要求8所述的装置,其特征在于,所述筛选模块包括:
    排序单元,用于根据所述加权平均数由大到小的顺序对所述目标类型的API进行排序;
    筛选单元,用于根据所述排序结果,将前N个API作为所述参考API,N等于预设阈值。
  11. 如权利要求8-10任一项所述的装置,其特征在于,所述装置还包括:
    判断模块,用于判断所述目标API的加权平均数是否大于所述参考API中所有API的加权平均数,若否,则触发所述分析模块分析所述目标API和所述参考API的接口和运行逻辑。
  12. 如权利要求8所述的装置,其特征在于,所述分析模块具体用于:
    比较所述目标API和所述参考API的接口,若所述目标API和所述参考API的接口相同,则比较所述目标API和所述参考API的每个接口的运行逻辑,将所述运行逻辑的比较结果作为所述分析结果。
  13. 如权利要求12所述的装置,其特征在于,所述分析模块具体还用于:
    若所述目标API和所述参考API的接口不相同,则从所述参考API中提取与所述目标API不同的接口,对提取到的所述接口进行关联搜索,以确定提取到的所述接口的功能,并将确定的所述功能作为所述分析结果。
  14. 如权利要求13所述的装置,其特征在于,
    所述分析结果还包括提取到的所述接口对应的运行逻辑。
  15. 一种应用程序编程接口API的分享方法,其特征在于,包括:
    获取目标类型的API的统计条件,所述统计条件包括至少一个子统计条件,每个所述子统计条件对应一个权值;
    根据所述统计条件计算所述目标类型的API中每个所述API的加权平均数;
    根据所述加权平均数从所述目标类型的API中确定出参考API;
    确定推荐所述参考API的目标用户,并获取所述目标用户开发的与所述目标类型相同类型的目标API;
    分析所述目标API和所述参考API的接口和运行逻辑,获得分析结果;
    将所述分析结果推送给所述目标用户。
  16. 如权利要求15所述的方法,其特征在于,
    所述根据所述加权平均数从所述目标类型的API中确定出参考API包括:
    将所述目标类型中加权平均数大于或等于参考门限值的API确定为所述参考API,所述参考门限值是系统预先指定的。
  17. 如权利要求15所述的方法,其特征在于,
    所述根据所述加权平均数从所述目标类型的API中确定出参考API包括:
    根据所述加权平均数由大到小的顺序对所述目标类型的API进行排序;
    根据所述排序结果,将前N个API作为所述参考API,N等于预设阈值。
  18. 如权利要求15-17中任一项所述的方法,其特征在于,
    所述确定推荐所述参考API的目标用户包括:
    将订阅了所述目标类型API的用户确定为所述目标用户;或者,
    将上传了所述目标类型API的用户确定为所述目标用户。
  19. 一种应用程序编程接口API的分享装置,其特征在于,包括:
    第一获取模块,用于获取目标类型的API的统计条件,所述统计条件包括至少一个子统计条件,每个所述子统计条件对应一个权值;
    计算模块,用于根据所述统计条件计算所述目标类型的API中每个所述API的加权平均数;
    筛选模块,用于根据所述加权平均数从所述目标类型的API中确定出参考API;
    第二获取模块,用于确定推荐所述参考API的目标用户,并获取所述目标用户开发的类型与所述目标类型相同的目标API;
    分析模块,用于分析所述目标API和所述参考API的接口和运行逻辑,获得分析结果;
    推送模块,用于将所述分析结果推送给所述目标用户。
  20. 如权利要求19所述的装置,其特征在于,所述筛选模块具体用于:
    将所述目标类型中加权平均数大于或等于参考门限值的API确定为所述参考API,所述参考门限值是系统预先指定的。
  21. 如权利要求19任一项所述的装置,其特征在于,所述筛选模块包括:
    排序单元,用于根据所述加权平均数由大到小的顺序对所述目标类型的API进行排序;
    筛选单元,用于根据所述排序结果,将前N个API作为所述参考API,N等于预设阈值。
  22. 如权利要求19-21中任一项所述的装置,其特征在于,
    所述推送模块具体用于:
    将订阅了所述目标类型API的用户确定为所述目标用户;或者,
    将上传了所述目标类型API的用户确定为所述目标用户。
PCT/CN2016/091908 2015-10-28 2016-07-27 一种应用程序编程接口api的分享方法和装置 WO2017071341A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510714189.5 2015-10-28
CN201510714189.5A CN106648557B (zh) 2015-10-28 2015-10-28 一种应用程序编程接口api的分享方法和装置

Publications (1)

Publication Number Publication Date
WO2017071341A1 true WO2017071341A1 (zh) 2017-05-04

Family

ID=58629818

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/091908 WO2017071341A1 (zh) 2015-10-28 2016-07-27 一种应用程序编程接口api的分享方法和装置

Country Status (2)

Country Link
CN (1) CN106648557B (zh)
WO (1) WO2017071341A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112738632A (zh) * 2020-12-28 2021-04-30 深圳创维-Rgb电子有限公司 智能电视性能的优化方法、装置、设备及存储介质
CN112968808A (zh) * 2021-02-01 2021-06-15 中科视拓(南京)科技有限公司 一种通用的部署深度目标检测网络api的方法

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108959014B (zh) * 2017-05-17 2022-04-12 北京京东尚科信息技术有限公司 用于监控平台的方法和装置
CN109814855A (zh) * 2017-11-21 2019-05-28 南京大学 一种基于对象分类和自适应子图匹配的api推荐方法
CN109936589B (zh) * 2017-12-15 2021-09-03 中国移动通信集团浙江有限公司 基于api热度值的动态负载均衡方法、装置及平台
CN110519749B (zh) * 2018-05-21 2021-07-20 华为技术有限公司 一种api信息传输方法及装置
US11275624B2 (en) * 2018-06-14 2022-03-15 Qliktech International Ab Methods and systems for application program interface management
CN116016666A (zh) * 2022-12-21 2023-04-25 中盈优创资讯科技有限公司 一种api发布的实现方法及装置

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7603658B2 (en) * 2004-02-19 2009-10-13 Oracle International Corporation Application functionality for a test tool for application programming interfaces
CN102203730A (zh) * 2011-05-20 2011-09-28 华为技术有限公司 开放应用程序编程接口选择方法及设备
CN104978261A (zh) * 2014-04-03 2015-10-14 腾讯科技(深圳)有限公司 应用程序的测试方法、装置及系统

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7512957B2 (en) * 2004-12-03 2009-03-31 Microsoft Corporation Interface infrastructure for creating and interacting with web services
CN100498697C (zh) * 2005-09-29 2009-06-10 腾讯科技(深圳)有限公司 一种应用编程接口控制方法和控制功能模块
CN101620536B (zh) * 2009-08-17 2012-11-14 用友软件股份有限公司 一种调用功能函数的方法和装置
CN102203736B (zh) * 2011-05-20 2014-04-02 华为技术有限公司 开放应用程序编程接口调用方法及设备
CN104298679B (zh) * 2013-07-18 2019-05-07 腾讯科技(深圳)有限公司 应用业务推荐方法及装置

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7603658B2 (en) * 2004-02-19 2009-10-13 Oracle International Corporation Application functionality for a test tool for application programming interfaces
CN102203730A (zh) * 2011-05-20 2011-09-28 华为技术有限公司 开放应用程序编程接口选择方法及设备
CN104978261A (zh) * 2014-04-03 2015-10-14 腾讯科技(深圳)有限公司 应用程序的测试方法、装置及系统

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112738632A (zh) * 2020-12-28 2021-04-30 深圳创维-Rgb电子有限公司 智能电视性能的优化方法、装置、设备及存储介质
CN112738632B (zh) * 2020-12-28 2022-11-25 深圳创维-Rgb电子有限公司 智能电视性能的优化方法、装置、设备及存储介质
CN112968808A (zh) * 2021-02-01 2021-06-15 中科视拓(南京)科技有限公司 一种通用的部署深度目标检测网络api的方法
CN112968808B (zh) * 2021-02-01 2022-06-21 中科视拓(南京)科技有限公司 一种通用的部署深度目标检测网络api的方法

Also Published As

Publication number Publication date
CN106648557B (zh) 2020-04-03
CN106648557A (zh) 2017-05-10

Similar Documents

Publication Publication Date Title
WO2017071341A1 (zh) 一种应用程序编程接口api的分享方法和装置
US11184241B2 (en) Topology-aware continuous evaluation of microservice-based applications
KR101558909B1 (ko) 가정을 위한 요건 메트릭의 반복적 시뮬레이션 및 스키마 없는 구성 관리
US10057118B2 (en) Method and apparatus for enabling dynamic analytics configuration on a mobile device
CN108521353B (zh) 定位性能瓶颈的处理方法、设备及可读存储介质
US11055090B2 (en) Component management platform
US8959486B2 (en) Automatic regression testing based on cyclomatic complexity
US20170085621A1 (en) Estimating latency of an application
WO2019169723A1 (zh) 测试用例选择方法、装置、设备以及计算机可读存储介质
US9069915B2 (en) Identifying and routing poison tuples in a streaming application
US20170279923A1 (en) Provisioning of network services based on virtual network function performance characteristics
US9582264B1 (en) Application rating prediction for defect resolution to optimize functionality of a computing device
US10067860B2 (en) Defining test bed requirements
US20150242380A1 (en) Checking testing coverage
CN110134711A (zh) 大数据的处理方法、装置、设备及计算机可读存储介质
US20150019722A1 (en) Determining, managing and deploying an application topology in a virtual environment
US20180288143A1 (en) Managing idle and active servers in cloud data centers
US11748305B2 (en) Suggesting a destination folder for a file to be saved
CN110781180A (zh) 一种数据筛选方法和数据筛选装置
US11663505B2 (en) Estimating performance and required resources from shift-left analysis
CN112527459A (zh) 一种基于Kubernetes集群的日志分析方法及装置
KR20160103098A (ko) 클라우드 데이터 센터 분석을 위한 기술
EP4221241A1 (en) Video editing method and apparatus, electronic device, and medium
CN109800775B (zh) 文件聚类方法、装置、设备及可读介质
CN110780937B (zh) 任务发布方法、装置、计算机可读存储介质及设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16858780

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16858780

Country of ref document: EP

Kind code of ref document: A1