WO2016107510A1 - 一种应用程序编程接口api调用记录的管理方法和装置 - Google Patents

一种应用程序编程接口api调用记录的管理方法和装置 Download PDF

Info

Publication number
WO2016107510A1
WO2016107510A1 PCT/CN2015/099160 CN2015099160W WO2016107510A1 WO 2016107510 A1 WO2016107510 A1 WO 2016107510A1 CN 2015099160 W CN2015099160 W CN 2015099160W WO 2016107510 A1 WO2016107510 A1 WO 2016107510A1
Authority
WO
WIPO (PCT)
Prior art keywords
api
api call
charging
same
call records
Prior art date
Application number
PCT/CN2015/099160
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 WO2016107510A1 publication Critical patent/WO2016107510A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/02Details
    • H04L12/14Charging, metering or billing arrangements for data wireline or wireless communications

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a management method and apparatus for an API of an application programming interface.
  • the API Application Programming Interface
  • the API is used to open the service capability of the capability server.
  • the API is usually called through the API gateway to implement access to the capability server.
  • the API gateway will generate an API call record, and then the API gateway will transmit the API call record to the API charging gateway.
  • the API charging gateway calculates the call according to the API call record according to the preset charging rules. The cost of the API.
  • the main disadvantage of this technology is that the number of API call records that the API charging gateway needs to process is too large, which occupies more processing resources.
  • An object of the present invention is to provide a management method and apparatus for an application programming interface API call record, which is used to reduce the number of API call records generated by an API gateway to a certain extent, thereby reducing the API call record that the API charging gateway needs to process. The amount of the release of a portion of the processing resources.
  • an embodiment of the present invention provides a management method for an application programming interface API call record, where the method includes:
  • each of the API call records in the plurality of API call records includes at least the following attribute information: a caller identifier, a call time Called time, and a resource Source usage, wherein the caller identifier is used to represent a caller of the API, and the Called time is used to indicate time information that the API is called;
  • the resources recorded in each API call record in the two or more API call records in the same billing period, having the same caller identifier and having the same billing unit price in the plurality of API call records The usage amount is superimposed, and an API call record after the superposition processing is obtained.
  • the charging result obtained by charging the over-processed one API call record according to the charging unit price, and The unit price of the fee is the same as the charging result obtained by charging two or more API call records having the same caller ID and having the same billing unit price in the plurality of API call records.
  • Each of the plurality of API call records further includes the following attribute information: an API identifier, where the API identifier is used to represent the called API;
  • each API call record in the two or more API call records in the same billing period, having the same caller identifier and having the same billing unit price in the plurality of API call records The resource usage is superimposed, and an API call record after the superposition processing is obtained, which specifically includes:
  • the billing result obtained by the fee is calculated according to the billing unit price, and two or more API call records having the same caller identifier and having the same API identifier in the plurality of API call records are counted.
  • the billing result obtained by the fee is the same.
  • the billing unit price is a price for invoking the API unit duration, a price for calling the API unit number, a price of a unit data flow acquired by calling the API, or a price of a unit storage space acquired by calling the API.
  • the billing period is one month.
  • an embodiment of the present invention provides a management device for an application programming interface API call record, including:
  • An obtaining unit configured to acquire a plurality of API call records, each of the plurality of API call records includes at least the following attribute information: a caller identifier, a call time, a resource time, and a resource usage, where The caller identifier is used to represent a caller of the API, and the Called time is used to indicate time information that the API is called;
  • a determining unit configured to determine, according to a Called time of each API call record in the plurality of API call records, a billing period to which each API call record in the plurality of API call records belongs;
  • a management unit configured to, according to a preset charging unit price, two or more of the plurality of API call records having the same caller identifier and having the same billing unit price in the same billing period The resource usage of each API call record in the API call record is superimposed, and an API call record after the superposition processing is obtained.
  • Each of the plurality of API call records further includes the following attribute information: an API identifier, where the API identifier is used to represent the called API;
  • the management unit is specifically configured to: use, in the plurality of API call records, resource usage of each API call record in two or more API call records that are in the same billing period, have the same caller identifier, and have the same API identifier. Superimpose processing and get an API call record after superposition processing.
  • the charging result obtained by charging two or more API call records having the same caller identity and having the same API identifier is the same.
  • the management unit is further configured to perform filtering processing on the plurality of API call records, and filter out an API call record in which the unit price of the charge is zero in the plurality of API call records.
  • the billing unit price is a price for invoking the API unit duration, a price for calling the API unit number, a price of a unit data flow acquired by calling the API, or a price of a unit storage space acquired by calling the API.
  • the billing period is one month.
  • an embodiment of the present invention provides a management system for an application programming interface API call record, including an API gateway, an API charging gateway, and the first to second aspects of the second aspect or the second aspect.
  • the API gateway is configured to generate the plurality of API call records acquired by the management device of the API call record;
  • the API charging gateway is configured to perform an API call record after the management device of the API call record is superimposed, and perform charging according to the preset charging unit price.
  • the management device of the API call record is integrated in the API gateway, or the management device of the API call record is integrated in the API charging gateway.
  • the embodiment of the present invention provides a method for managing an API call record, which includes: according to a preset charging unit price, multiple API call records are located in the same charging period, have the same caller identifier, and have the same billing.
  • the resource usage recorded by more than two API calls of the unit price is superimposed to obtain an API call record that is superimposed and processed.
  • FIG. 1 is a schematic diagram of an application scenario of a method for managing an API call record according to an embodiment of the present invention
  • 2a is a schematic flowchart of a method for managing an API call record according to an embodiment of the present invention
  • FIG. 2b is a schematic flowchart diagram of another method for managing API call records according to an embodiment of the present disclosure
  • FIG. 3a is a schematic diagram of an API call record before merging according to an embodiment of the present invention.
  • FIG. 3b is a schematic diagram of a merged API call record according to an embodiment of the present invention.
  • FIG. 4 is a schematic structural diagram of an apparatus for managing an API call record according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a gateway according to an embodiment of the present disclosure.
  • FIG. 6 is a schematic structural diagram of a management system of an API call record according to an embodiment of the present invention.
  • Gateway is also known as the network gateway, protocol converter.
  • the gateway implements network interconnection above the network layer. It is the most complex network interconnection device and is only used for different network interconnections of two high-level protocols. Gateways can be used for both WAN and LAN interconnections.
  • a gateway is a computer system or device that acts as a conversion.
  • a gateway is a translator between two systems that use different communication protocols, data formats or languages, and even completely different architectures. Gateway Commonly used in the function is protocol conversion, but it is also used for security protection, statistical accounting, message forwarding blocking, and so on.
  • the technical solution provided by the present invention is directed to a statistical charging function of a gateway.
  • the application programming interface (API) of the embodiment of the present invention is used to open the processing capability of the capability server.
  • the caller wants to use the capability provided by the capability server to invoke the capability through the API gateway.
  • the API of the server to achieve access to the capability server; in addition, the capability provided by the capability server is usually a paid service, so usually every time the API is called, the API gateway generates an API call record and transmits the API call record to the API meter.
  • the fee gateway is charged by the API charging gateway according to the API call record.
  • the API gateway in the embodiment of the present invention refers to a Web WPI gateway, that is, the API gateway and the capability server shown in FIG. 1 are connected through a network communication.
  • the API gateway After the API gateway generates a batch of API call records, the batch of API call records is transmitted to the API charging gateway, and the API charging gateway performs unified charging processing.
  • the batch of API call records is a record of all API calls generated during a billing cycle.
  • the technical solution provided by the embodiment of the present invention is to manage the batch of API call records to reduce the number of API call records to be processed by the API charging gateway, thereby releasing the processing resources of the API charging gateway to a certain extent.
  • FIG. 2a is a schematic flowchart of a method for managing an API call record according to an embodiment of the present invention. It should be understood that the method can be used in the application scenario shown in FIG. Specifically, as shown in FIG. 2a, the method for managing the API call record provided by the embodiment of the present invention includes the following steps:
  • each API call record in the plurality of API call records includes at least the following attribute information: a caller identifier, a call time Called time, and a resource usage, wherein the caller Identifying a caller for indicating the API, the Called time is used to indicate time information that the API is called;
  • the caller identifier is used to identify the caller of the API, and from the perspective of billing, the caller identifier is used to identify who the charging object is.
  • the caller identifier is an APP Key (ie, an App identifier), that is, the APP key can uniquely identify who the caller is, such as an enterprise customized APP, through the APP key, Identify the caller as the business.
  • APP Key ie, an App identifier
  • the resource usage refers specifically to the duration of the access capability server (or the duration of calling the API), the number of accessing the capability server (or the number of times the API is called), the data traffic provided by the acquisition capability server, or the acquisition capability server. The size of the space, etc.
  • the charging mode set by the operator determines the specific content of the resource usage.
  • the resource usage refers to the number of accessing the capability server (or the number of times the API is called); if the charging mode set by the operator is charged according to the calling duration
  • the resource usage refers to the duration of the access capability server (or the duration of calling the API); if the charging mode set by the operator is the data flow fee provided by the capability server, the resource usage refers to the acquisition capability.
  • the billing cycle is one month.
  • the resource usage is superimposed and an aggregated API call record is obtained.
  • the charging result obtained by charging the over-processed one API call record according to the charging unit price, and the charging of the plurality of APIs according to the charging unit price is the same. That is, the basic condition that the method provided by the embodiment of the present invention needs to follow is that the correctness of the charging result is not affected.
  • the preset charging unit price is usually located in the API charging gateway and is preset by the operator.
  • step 205 is specifically as follows: according to the preset charging unit price, the plurality of API call records are located in the same billing period, have the same APP Key, and have the same The resource usage of each API call record in the two or more API call records of the billing unit price is superimposed, and an API call record after the superposition processing is obtained. Referring to FIG. 3a and FIG.
  • the APP key of the first four API call records is APP_Key1; and according to the Called Time of the first four API call records, it can be known that the first four API call records are located at 2014-10.
  • the calling cycle that is, the calling cycle is the same; further, the first four API call records are charged according to the number of calls, and the preset charging unit price in the API gateway is the same (not shown in the figure), so it can be
  • the resource usage of the first four API call records is superimposed, that is, the number of calls is superimposed, and the call record shown in the first bar in Fig. 3b is obtained.
  • the merging method of the 5th and 6th API call records in FIG. 3a is the same as the merging method of the first 4 API call records described above, and will not be described here.
  • the billing unit price is a price for calling the API unit duration, a price for calling the API unit number, a price of a unit data flow obtained by calling the API, or a unit storage space obtained by calling the API. s price.
  • the billing unit price is preset by the operator of the capability server, and the billing unit price is not set to be the same, such as a common call price increase, or a variety of bills, etc., the operator is usually at After the end of a billing cycle, the unit price of the bill is changed.
  • the method of the embodiment of the present invention may further include the following steps: filtering the plurality of API call records, and filtering out the API call record in which the unit price of the charge is zero in the plurality of API call records. .
  • the last two API call records in the table are free, or the default billing unit price of the API billing gateway is zero, so the API billing gateway is not required for billing processing, so filtering is performed.
  • the last two API call records do not affect the billing results.
  • the filtering step occurs after step S201. Specifically, it may occur after step S201, before step S203, or after step S203, before S205, or after step S205. However, preferred The filtering step occurs after step S201 and before step S203, because the filtering process is performed before the superimposition, so that the amount of data to be processed when performing the superimposition processing is reduced, thereby ensuring reduction of API charging gateway processing.
  • the execution efficiency of the management method of the API call record provided by the embodiment of the present invention is improved on the basis of the number of the API call records and the processing resources of the API charging gateway.
  • the embodiment of the present invention provides a method for managing an API call record, which includes: according to a preset charging unit price, multiple API call records are located in the same charging period, have the same caller identifier, and have the same The resource usage of the two or more API call records of the billing unit price is superimposed to obtain an API call record that is superimposed and processed.
  • the number of API call records that the API charging gateway needs to perform charging processing can be reduced without affecting the correctness of the charging result, and part of the processing resources are released.
  • FIG. 2b another method for managing API call records according to an embodiment of the present invention is provided.
  • Schematic diagram of the process it should be understood that the method can be used in the application scenario shown in FIG.
  • the method for managing the API call record provided by the embodiment of the present invention includes the following steps:
  • each of the plurality of API call records includes at least the following attribute information: a caller identifier, a call time, an API identifier, and a resource usage, where The caller identifier is used to represent the caller of the API, the Called time is used to indicate time information that the API is called, and the API identifier is used to represent the invoked API;
  • the difference between this embodiment and the embodiment shown in FIG. 2a is that the merged object defined by the embodiment of the present invention is different from the merged object defined by the embodiment shown in FIG. 2a.
  • the plurality of API call records are superimposed on the resource usage of each API call record in two or more API call records having the same caller ID and having the same billing unit price in the same billing record, but in the In the embodiment shown in FIG. 2b, it is to "record each API call record in two or more API call records of the plurality of API call records that are in the same billing period and have the same caller identifier and have the same API identifier. Resource usage is superimposed.”
  • the charging result obtained by charging the over-processed one API call record according to the charging unit price, and charging according to the charging The unit price is the same as the charging result obtained by charging the two or more API call records in the same billing period and having the same caller ID and having the same API identifier in the plurality of API call records.
  • FIG. 2b and the embodiment shown in FIG. 2a only have the above differences, and other explanations applicable to the embodiment shown in FIG. 2a are also applicable to the drawings.
  • the embodiment shown in FIG. 2b that is, the two embodiments can be referred to each other, and details are not described herein again.
  • the embodiment of the present invention provides a method for managing an API call record, which specifically includes: two or more of the plurality of API call records having the same caller identifier and having the same API identifier in the same billing period.
  • the resource usage of each API call record in the API call record is superimposed, and an API call record after the superposition processing is obtained.
  • the management method of the API call record provided by the embodiment of the present invention does not depend on the billing unit price, and the technical solution provided by the embodiment is simpler and easier to implement than the embodiment corresponding to FIG. 2a.
  • FIG. 4 is a schematic structural diagram of a management device 40 for API call record according to an embodiment of the present invention. It should be noted that the management device 40 of the API call record can be used in the figure. In the application scenario diagram described above, preferably, the management device 40 of the API call record is integrated in the API gateway or the API charging gateway described in FIG. Specifically, as shown in FIG. 4, the management device 40 of the API call record is composed of the following components:
  • the obtaining unit 41 is configured to acquire a plurality of API call records, each of the plurality of API call records includes at least the following attribute information: a caller identifier, a call time, a resource time, and a resource usage, where The caller identifier is used to represent a caller of the API, and the Called time is used to indicate time information that the API is called;
  • the caller identifier is used to identify the caller of the API, and from the perspective of billing, the caller identifier is used to identify who the charging object is.
  • the caller identifier is an APP Key (ie, an App identifier), that is, the APP key can uniquely identify who the caller is, such as an enterprise customized APP, through the APP key, Identify the caller as the business.
  • APP Key ie, an App identifier
  • the charging mode set by the operator determines the specific content of the resource usage. If the charging mode set by the operator is per-time charging, the resource usage refers to the number of accessing the capability server (or the number of times the API is called); if the charging mode set by the operator is charged according to the calling duration The resource usage refers to the duration of the access capability server (or the duration of calling the API); if the charging mode set by the operator is the data flow fee provided by the capability server, the resource usage refers to the acquisition capability. The data traffic provided by the server; if the charging mode set by the operator is charged according to the space provided by the capability server, the resource usage refers to the size of the space provided by the capability server, and the like. It is not enumerated here, but it should be known that the specific content of the resource usage is related to the charging mode set by the operator for a specific capability server.
  • a determining unit 43 configured to determine, according to a Called time of each API call record in the plurality of API call records, each API call record in the plurality of API call records belongs to Billing cycle
  • the management unit 45 is configured to: in the plurality of API call records, the plurality of API call records in the same billing period, having the same caller identifier, and having the same billing unit price, according to the preset billing unit price An API calls the recorded resource usage for superposition processing, and obtains an API call record after the superposition processing.
  • the charging result obtained by charging the one API call record after the superimposition processing is performed, and the charging of the plurality of APIs is performed according to the charging unit price.
  • the charging result obtained by charging two or more API call records having the same caller ID and having the same billing unit price for the same billing period is the same.
  • the billing unit price is a price for invoking the duration of the API unit, a price for calling the API unit number, a price of a unit data flow obtained by calling the API, or a unit storage space obtained by calling the API. s price.
  • the billing unit price is preset by the operator of the capability server, and the billing unit price is not set to be the same, such as a common call price increase, or a variety of bills, etc., the operator is usually at After the end of a billing cycle, the unit price of the bill is changed.
  • step 205 is specifically as follows: according to the preset charging unit price, the plurality of API call records are located in the same billing period, have the same APP Key, and have the same The resource usage of each API call record in the two or more API call records of the billing unit price is superimposed, and an API call record after the superposition processing is obtained.
  • the APP Keys of the first four API call records are APP_Key1; According to the Called Time of the first four API call records, it can be known that the first four API call records are located in the calling cycle of 2014-10, that is, the calling cycle is the same; further, the first four API call records are in accordance with the call.
  • the number of billing is the same, and the billing unit price preset in the API gateway is the same (not shown in the figure), so the resource usage of the first four API call records can be superimposed, that is, the number of calls is superimposed to obtain The call record shown in the first bar in Figure 3b.
  • the merging method of the 5th and 6th API call records in FIG. 3a is the same as the merging method of the first 4 API call records described above, and will not be described here.
  • management unit 45 is further configured to perform filtering processing on the plurality of API call records, and filter out an API call record in which the charge unit price is zero in the plurality of API call records.
  • the last two API call records in the table are free, or the default billing unit price of the API billing gateway is zero, so the API billing gateway is not required for billing processing, so filtering is performed.
  • the last two API call records do not affect the billing results.
  • the management unit 45 is configured to place multiple API call records in the same billing period and have the same caller according to the preset billing unit price.
  • the resource usage of the two or more API call records identified and having the same billing unit price is superimposed to obtain an API call record that is superimposed and processed.
  • each of the plurality of API call records further includes the following attribute information: an API identifier, where the API identifier is used to represent the called API;
  • the management unit 45 is specifically configured to superimpose the resource usage of each API call record in two or more API call records in the same billing period, having the same caller identifier and having the same API identifier in the plurality of API call records. Process and get an API call record after superimposing.
  • the business management unit 45 will call more than two APIs that meet the condition.
  • the recorded resource usage is superimposed without regard to the billing unit price preset in the API charging gateway.
  • the charging result obtained by charging the over-processed one API call record according to the charging unit price, and the charging of the plurality of APIs according to the charging unit price is the same.
  • the embodiment of the present invention provides a management device for the API call record.
  • the management unit 45 is specifically configured to place the plurality of API call records in the same billing with respect to the management device provided in the previous embodiment.
  • the resource usage of each API call record in the two or more API call records with the same caller ID and the same API identifier is superimposed, and an API call record after the superposition processing is obtained.
  • the management device of the API call record provided by the embodiment of the present invention is simpler and easier to implement without depending on the billing unit price.
  • FIG. 5 is a schematic structural diagram of a gateway 500 according to an embodiment of the present invention.
  • the gateway 500 is a running carrier of a management device of an API call record according to the second embodiment. It should be understood that the gateway 500 can be used.
  • the gateway 500 refers to the API gateway; when the API charging gateway is the running carrier of the management device recorded by the API call described in the second embodiment, the gateway 500 refers to the API charging gateway; of course, the gateway 500 may also be an API gateway and API charging. Other gateways than the gateway.
  • the gateway 500 can include at least one processor 501, such as a CPU, at least one network interface 504, such as a physical network card, or other user interface 503, and a memory 505 and at least one communication bus 502.
  • the communication bus 502 is used to implement connection communication between these components.
  • the network interface 504 is configured to implement connection communication between the gateway 500 and the network.
  • the control device 500 connects the physical network card and/or the physical switch through the network interface 504 to receive data sent by other network devices.
  • the user interface 503 may include a display, a keyboard or other pointing device, such as a mouse, a trackball, a touchpad or a touch sensitive display.
  • the memory 605 may include a high speed random access memory (RAM), and may also include a non-volatile memory such as at least one disk memory.
  • the memory 605 may further include at least one storage device located away from the foregoing processor 501.
  • the memory 505 stores the following elements, executable modules or data structures, or a subset thereof, or their extended set: the operating system 5051, which contains various system programs for implementing various basic services. And processing hardware-based tasks; the application module 5052 includes various applications for implementing various application services.
  • the application module 5052 includes, but is not limited to, an acquisition unit, a determining unit, and a management unit included in the management device of the API call record described in the second embodiment.
  • processor 501 is used to implement all the functions of the management device of the API call record described in the second embodiment, and details are not described herein again. For details, refer to the second embodiment.
  • the embodiment of the present invention provides a gateway, which is a running carrier of the management device of the API call record described in the embodiment, and based on the gateway, can be located in multiple API call records according to a preset charging unit price. Same billing cycle, with the same caller ID and the same The resource usage of the two or more API call records of the billing unit price is superimposed to obtain an API call record that is superimposed and processed. Therefore, under the premise of not affecting the correctness of the charging result, the number of API call records that the API charging gateway needs to perform charging processing is reduced, and part of the processing resources are released.
  • FIG. 6 is a schematic structural diagram of a management system of an API call record according to an embodiment of the present invention.
  • the management system of the API call record can be used in the application scenario shown in FIG. 1 .
  • the API gateway is configured to generate the plurality of API call records acquired by the management device of the API call record; And an API call record processed by the management device that records the API call record, and performs charging according to the preset charging unit price.
  • the management device of the API call record is integrated in the API gateway, or the management device of the API call record is integrated in the API charging gateway.
  • the embodiment of the present invention provides a management system for API call records.
  • the management system based on the API call record can set multiple API call records in the same billing period and have the same caller identifier according to the preset billing unit price. And the resource usage of the two or more API call records with the same billing unit price is superimposed to obtain an API call record that is superimposed and processed. Therefore, under the premise of not affecting the correctness of the charging result, the number of API call records that the API charging gateway needs to perform charging processing is reduced, and part of the processing resources are released.
  • the disclosed systems, devices, and The method can be implemented in other ways.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the functions may be stored in a computer readable storage medium if implemented in the form of a software functional unit and sold or used as a standalone product.
  • the technical solution of the present invention which is essential or contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product, which is stored in a storage medium, including
  • the instructions are used to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to perform all or part of the steps of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Meter Arrangements (AREA)

Abstract

本发明涉及流计算技术领域。本发明实施例提供一种应用程序编程接口API调用记录的管理方法存储管理方法,包括:获取多条API调用记录;根据所述多条API调用记录中每条API调用记录的Called time,确定所述多条API调用记录中每条API调用记录各自所属的计费周期;根据预设的计费单价,将所述多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同的计费单价的两条以上API调用记录中每一API调用记录的资源使用量进行叠加处理,并得到经过叠加处理后的一条API调用记录。采用本技术方案,能够减少API计费网关需要处理的API调用记录的数量,释放出一部分处理资源。

Description

一种应用程序编程接口API调用记录的管理方法和装置
本申请要求于2015年1月4日提交中国专利局、申请号为201510003882.1、发明名称为“一种应用程序编程接口API调用记录的管理方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及计算机技术领域,尤其涉及一种应用程序编程接口API调用记录的管理方法和装置。
背景技术
API(Application Programming Interface,应用程序编程接口)用于将能力服务器的服务能力对外开放,使用时,通常通过API网关调用API以实现对能力服务器的访问。每调用一次API,API网关会产生一条API调用记录,然后API网关会将该API调用记录传输给API计费网关,API计费网关按照预置的计费规则,根据API调用记录计算本次调用API所产生的费用。
这种技术的主要缺点在于:API计费网关需要处理的API调用记录数量太大,占用了较多的处理资源。
发明内容
本发明的目的是提供一种应用程序编程接口API调用记录的管理方法和装置,用于在一定程度上减少API网关产生的API调用记录的数量,进而减少API计费网关需要处理的API调用记录的数量,释放出一部分处理资源。
第一方面,本发明实施例提供一种应用程序编程接口API调用记录的管理方法,该方法包括:
获取多条API调用记录,所述多条API调用记录中的每一条API调用记录均至少包括下述属性信息:调用者标识、调用时刻Called time和资 源使用量,其中,所述调用者标识用于表示所述API的调用者,所述Called time用于表示所述API被调用的时刻信息;
根据所述多条API调用记录中每条API调用记录的Called time,确定所述多条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获取的单位数据流量的价格或调用所述API获取的单位存储空间的价格。
结合第一方面或第一方面的第一种实施方式至第一方面的第五种实施方式中任一种实施方式,在第一方面的第六种实施方式下,
所述计费周期为一个月。
第二方面,本发明实施例提供一种应用程序编程接口API调用记录的管理装置,包括:
获取单元,用于获取多条API调用记录,所述多条API调用记录中的每一条API调用记录均至少包括下述属性信息:调用者标识、调用时刻Called time和资源使用量,其中,所述调用者标识用于表示所述API的调用者,所述Called time用于表示所述API被调用的时刻信息;
确定单元,用于根据所述多条API调用记录中每条API调用记录的Called time,确定所述多条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计费网关和如第二方面或第二方面的第一种实施方式至第二方面的第六种实施方式中的任一种实施方式所述的API调用记录的管理装置:
所述API网关用于产生所述API调用记录的管理装置获取的所述多条API调用记录;
所述API计费网关用于对所述API调用记录的管理装置叠加处理后的一条API调用记录,按照所述预设的计费单价进行计费。
结合第三方面,在第三方面的第一种实施方式下,
所述API调用记录的管理装置集成在所述API网关,或者,所述API调用记录的管理装置集成在所述API计费网关。
可知,本发明实施例提供一种API调用记录的管理方法,具体包括:根据预设的计费单价,将多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同计费单价的两条以上API调用记录的资源使用量进行叠加处理,得到经过叠加处理的一条API调用记录。采用该技术方案,能够在不影响计费结果正确性的前提下,减少了API计费网关需要进行计费处理的API调用记录的数目,释放出了部分处理资源。
附图说明
为了更清楚地说明本发明实施例的技术方案,下面将对实施例或现有技 术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本发明实施例提供的API调用记录的管理方法的应用场景示意图;
图2a为本发明实施例提供的一种API调用记录的管理方法的流程示意图;
图2b为本发明实施例提供的另一种API调用记录的管理方法的流程示意图;
图3a为本发明实施例提供的合并前的API调用记录的示意图;
图3b为本发明实施例提供的合并后的API调用记录的示意图;
图4为本发明实施例提供的API调用记录的管理装置的结构示意图;
图5为本发明实施例提供的网关的结构示意图;
图6为本发明实施例提供的API调用记录的管理系统的结构示意图。
具体实施方式
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
网关(Gateway)又称网间连接器、协议转换器。网关在网络层以上实现网络互连,是最复杂的网络互连设备,仅用于两个高层协议不同的网络互连。网关既可以用于广域网互连,也可以用于局域网互连。网关是一种充当转换重任的计算机系统或设备。在使用不同的通信协议、数据格式或语言,甚至体系结构完全不同的两种系统之间,网关是一个翻译器。网关的 功能中常用的是协议转换,但也用于安全防护、统计计费、消息转发阻断等。本发明提供的技术方案针对的是网关的统计计费功能。
本发明实施例所述的应用程序编程接口(API,Application Programming Interface)用于将能力服务器的处理能力对外开放,具体参见附图1,调用者欲使用能力服务器提供的能力,通过API网关调用能力服务器的API,以实现对能力服务器的访问;另外,能力服务器提供的能力通常是有偿服务,所以通常每调用一次API,API网关就会产生一条API调用记录并将该API调用记录传输给API计费网关,由API计费网关根据该API调用记录进行计费。需要说明的是,本发明实施例所述的API网关指的是Web WPI网关,也即图1所示的API网关和能力服务器之间通过网络通信连接。
在现有技术中,API网关产生一批API调用记录后,会将该一批API调用记录传输给API计费网关,由API计费网关进行统一计费处理。通常,该一批API调用记录是一个计费周期内产生的全部API调用记录。本发明实施例提供的技术方案就是对该一批API调用记录进行管理,以减少API计费网关待处理的API调用记录的数目,从而在一定程度上释放API计费网关的处理资源。
实施例一
参阅附图2a,为本发明实施例提供的一种API调用记录的管理方法的流程示意图,应当理解的是,该方法可用于图1所示的应用场景中。具体的,如图2a所示,本发明实施例提供的API调用记录的管理方法包括下述步骤:
S201、获取多条API调用记录,所述多条API调用记录中的每一条API调用记录均至少包括下述属性信息:调用者标识、调用时刻Called time和资源使用量,其中,所述调用者标识用于表示所述API的调用者,所述Called time用于表示所述API被调用的时刻信息;
需要说明的是,所述多条API调用记录是由API网关产生的。
值得注意的是,所述调用者标识用于标识所述API的调用者,从计费的角度说,所述调用者标识用于标识收费对象是谁。作为一个具体的实施例,所述调用者标识为APP Key(也即App标识),也即通过APP key能够唯一的识别出调用者是谁,比如企业定制的APP,通过该APP key,就能识别出调用者为该企业。参见附图3a,即为使用APP Key来确定调用者,应当理解的是,同一个APP Key对应的调用者是唯一的,不存在同一个APP key对应两个以上调用者的情况。
需要说明的是,所述资源使用量具体指访问能力服务器的时长(或者调用API的时长)、访问能力服务器的次数(或者调用API的次数)、获取能力服务器提供的数据流量或获取能力服务器提供的空间大小等。针对一个具体的能力服务器,运营商设置的计费方式决定了所述资源使用量的具体内容。如果运营商设置的计费方式是按次计费的,则所述资源使用量指访问能力服务器的次数(或者调用API的次数);如果运营商设置的计费方式是按调用时长计费的,则所述资源使用量指访问能力服务器的时长(或者调用API的时长);如果运营商设置的计费方式是按能力服务器提供的数据流量计费的,则所述资源使用量指获取能力服务器提供的数据流量;如果运营商设置的计费方式是按能力服务器提供的空间大小计费的,则所述资源使用量指获取能力服务器提供的空间大小等等。此处不再一一列举,但需要知道的是,所述资源使用量的具体内容与运营商针对某一具体的能力服务器设置的计费方式有关。
S203、根据所述多条API调用记录中每条API调用记录的Called time,确定所述多条API调用记录中每条API调用记录各自所属的计费周期;
通常,计费周期为一个月。参见附图3a,容易得知的是,根据called time,能够确定出调用动作具体发生在某年某月某日的某时某刻,所以根据called time,当然能够确定出调用作为具体位于哪个计费周期。
S205、根据预设的计费单价,将所述多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同的计费单价的两条以上API调用记录中每一API调用记录的资源使用量进行叠加处理,并得到经过叠加处理后的一条API调用记录。
值得注意的是,按照所述计费单价对所述经过叠加处理后的一条API调用记录进行计费得到的计费结果,与,按照所述计费单价,对所述多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同的计费单价的两条以上API调用记录进行计费得到的计费结果,是相同的。也即,本发明实施例提供的方法需要遵循的基本条件是不影响计费结果的正确性。
需要说明的是,预设的计费单价通常位于API计费网关中,是由运营商预设的。
参见附图3a和3b,需要说明的是,在图3a和3b所示的实施例中,调用者标识为APP Key,也即通过APP Key即可确定出调用者是谁。所以,步骤205在图3a和3b所示的实施例中,应具体为:根据预设的计费单价,将所述多条API调用记录中位于同一计费周期、具有相同APP Key且具有相同的计费单价的两条以上API调用记录中每一API调用记录的资源使用量进行叠加处理,并得到经过叠加处理后的一条API调用记录。进一步参见附图3a和3b,可知,前4条API调用记录的APP Key均为APP_Key1;且根据前4条API调用记录的Called Time,可知,该前4条API调用记录均位于2014-10这个调用周期,也即调用周期相同;进一步的,该前4条API调用记录均是按照调用次数计费的,且API网关中预设的计费单价相同(图中未示出),所以可以对该前4条API调用记录的资源使用量进行叠加处理,即调用次数进行叠加,得到如图3b中第一条所示的调用记录。图3a中的第5条和第6条API调用记录的合并方法与上述的前4条API调用记录的合并方法是一样的,此处不再赘述。
需要说明的是,所述计费单价为调用所述API单位时长的价格、调用所述API单位次数的价格、调用所述API获取的单位数据流量的价格或调用所述API获取的单位存储空间的价格。所述计费单价是由能力服务器的运营商预先设置的,且所述计费单价并不是已经设置就一成不变的,比如常见的话费涨价,或者,各种话费套餐等,运营商通常是在一个计费周期结束后,对计费单价进行变更的。
进一步的,本发明实施例所述的方法还可以包括下述步骤:对所述多条API调用记录进行过滤处理,滤除位于所述多条API调用记录中计费单价为零的API调用记录。
参见附图3a,该表中的最后两条API调用记录是免费的,或者说,API计费网关预设的计费单价为零,所以不需要API计费网关进行计费处理,所以滤除该最后两条API调用记录,不会对计费结果产生影响。
需要说明的是,该滤除步骤发生在步骤S201之后,具体的,可以发生在步骤S201之后、步骤S203之前,也可以发生在步骤S203之后、S205之前,或者发生在步骤S205之后.但是优选的,该滤除步骤发生在步骤S201之后、步骤S203之前,这是由于在叠加之前就进行了滤除处理,使得进行叠加处理时需要处理的数据量减少了,从而在保证减少API计费网关处理的API调用记录的数量、释放API计费网关的处理资源的基础上,提高了本发明实施例提供的API调用记录的管理方法的执行效率。
由上可知,本发明实施例提供一种API调用记录的管理方法,具体包括:根据预设的计费单价,将多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同计费单价的两条以上API调用记录的资源使用量进行叠加处理,得到经过叠加处理的一条API调用记录。采用该技术方案,能够在不影响计费结果正确性的前提下,减少了API计费网关需要进行计费处理的API调用记录的数目,释放出了部分处理资源。
参见附图2b,为本发明实施例提供的另一种API调用记录的管理方法 的流程示意图,应当理解的是,该方法可用于图1所示的应用场景中。具体的,如图2b所示,本发明实施例提供的API调用记录的管理方法包括下述步骤:
S211、获取多条API调用记录,所述多条API调用记录中的每一条API调用记录均至少包括下述属性信息:调用者标识、调用时刻Called time、API标识和资源使用量,其中,所述调用者标识用于表示所述API的调用者,所述Called time用于表示所述API被调用的时刻信息,所述API标识用于表示被调用的API;
S213、根据所述多条API调用记录中每条API调用记录的Called time,确定所述多条API调用记录中每条API调用记录各自所属的计费周期;
S215、将所述多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同API标识的两条以上API调用记录中每一API调用记录的资源使用量进行叠加处理,并得到经过叠加处理后的一条API调用记录。
本实施例与图2a所示的实施例的区别在于,本发明实施例限定的合并对象和图2a所示的实施例限定的合并对象不同,在图2a所示的实施例中,是“将所述多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同的计费单价的两条以上API调用记录中每一API调用记录的资源使用量进行叠加处理”,但在图2b所示的实施例中,是“将所述多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同API标识的两条以上API调用记录中每一API调用记录的资源使用量进行叠加处理”。
需要说明的是,图2b所示的实施例中所述的“具有相同API标识”和图2a所示的实施例中所述的“具有相同的计费单价”是不同的,它们之间存在下述关系:位于同一计费周期、具有相同调用者标识且具有相同API标识的两条以上API调用记录必然具有相同的计费单价,但是,位于同一计费周期、具有相同调用者标识且具有相同的计费单价的两条以上API调 用记录并不一定具有相同的API标识。
进一步的,由于位于同一计费周期、具有相同调用者标识且具有相同API标识的两条以上API调用记录必然具有相同的计费单价,所以,在图2b所示的实施例中,可以将符合该条件的两条以上API调用记录的资源使用量进行叠加,而不必考虑API计费网关中预设的计费单价。
应当理解的是,在附图2b所示的实施例中,按照所述计费单价对所述经过叠加处理后的一条API调用记录进行计费得到的计费结果,与,按照所述计费单价,对所述多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同API标识的两条以上API调用记录进行计费得到的计费结果,是相同的。
值得注意的是,附图2b所示的实施例和附图2a所示的实施例仅具有上述区别点,其他凡是适用于附图2a所示的实施例的解释说明,也同样适用于附图2b所示的实施例,也即,这两个实施例可以互相引用,此处不再赘述。
由上可知,本发明实施例提供一种API调用记录的管理方法,具体包括:将所述多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同API标识的两条以上API调用记录中每一API调用记录的资源使用量进行叠加处理,并得到经过叠加处理后的一条API调用记录。采用该方案,能够在不影响计费结果正确性的前提下,减少了API计费网关需要进行计费处理的API调用记录的数目,释放出了部分处理资源。进一步的,本发明实施例提供的API调用记录的管理方法,不依赖于计费单价,相对于对应于图2a所述的实施例来说,本实施例提供的技术方案更加简单、容易实现。
实施例二
参见附图4,为本发明实施例提供的一种API调用记录的管理装置40的结构示意图,需要说明的是,该API调用记录的管理装置40可以用在图 1所述的应用场景图中,优选的,该API调用记录的管理装置40集成在图1所述的API网关或者API计费网关。具体的,如图4所示,API调用记录的管理装置40由下述部件组成:
获取单元41,用于获取多条API调用记录,所述多条API调用记录中的每一条API调用记录均至少包括下述属性信息:调用者标识、调用时刻Called time和资源使用量,其中,所述调用者标识用于表示所述API的调用者,所述Called time用于表示所述API被调用的时刻信息;
值得注意的是,所述调用者标识用于标识所述API的调用者,从计费的角度说,所述调用者标识用于标识收费对象是谁。作为一个具体的实施例,所述调用者标识为APP Key(也即App标识),也即通过APP key能够唯一的识别出调用者是谁,比如企业定制的APP,通过该APP key,就能识别出调用者为该企业。参见附图3a,即为使用APP Key来确定调用者,应当理解的是,同一个APP Key对应的调用者是唯一的,不存在同一个APP key对应两个以上调用者的情况。
需要说明的是,针对一个具体的能力服务器,运营商设置的计费方式决定了所述资源使用量的具体内容。如果运营商设置的计费方式是按次计费的,则所述资源使用量指访问能力服务器的次数(或者调用API的次数);如果运营商设置的计费方式是按调用时长计费的,则所述资源使用量指访问能力服务器的时长(或者调用API的时长);如果运营商设置的计费方式是按能力服务器提供的数据流量计费的,则所述资源使用量指获取能力服务器提供的数据流量;如果运营商设置的计费方式是按能力服务器提供的空间大小计费的,则所述资源使用量指获取能力服务器提供的空间大小等等。此处不再一一列举,但需要知道的是,所述资源使用量的具体内容与运营商针对某一具体的能力服务器设置的计费方式有关。
确定单元43,用于根据所述多条API调用记录中每条API调用记录的Called time,确定所述多条API调用记录中每条API调用记录各自所属的 计费周期;
参见附图3a,容易得知的是,根据called time,能够确定出调用动作具体发生在某年某月某日的某时某刻,所以根据called time,当然能够确定出调用作为具体位于哪个计费周期。需要说明的是,通常,计费周期为一个月。
管理单元45,用于根据预设的计费单价,将所述多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同的计费单价的两条以上API调用记录中每一API调用记录的资源使用量进行叠加处理,并得到经过叠加处理后的一条API调用记录。
需要说明的是,按照所述计费单价对所述经过叠加处理后的一条API调用记录进行计费得到的计费结果,与,按照所述计费单价,对所述多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同的计费单价的两条以上API调用记录进行计费得到的计费结果,是相同的。
值得注意的是,所述计费单价为调用所述API单位时长的价格、调用所述API单位次数的价格、调用所述API获取的单位数据流量的价格或调用所述API获取的单位存储空间的价格。所述计费单价是由能力服务器的运营商预先设置的,且所述计费单价并不是已经设置就一成不变的,比如常见的话费涨价,或者,各种话费套餐等,运营商通常是在一个计费周期结束后,对计费单价进行变更的。
参见附图3a和3b,需要说明的是,在图3a和3b所示的实施例中,调用者标识为APP Key,也即通过APP Key即可确定出调用者是谁。所以,步骤205在图3a和3b所示的实施例中,应具体为:根据预设的计费单价,将所述多条API调用记录中位于同一计费周期、具有相同APP Key且具有相同的计费单价的两条以上API调用记录中每一API调用记录的资源使用量进行叠加处理,并得到经过叠加处理后的一条API调用记录。进一步参见附图3a和3b,可知,前4条API调用记录的APP Key均为APP_Key1; 且根据前4条API调用记录的Called Time,可知,该前4条API调用记录均位于2014-10这个调用周期,也即调用周期相同;进一步的,该前4条API调用记录均是按照调用次数计费的,且API网关中预设的计费单价相同(图中未示出),所以可以对该前4条API调用记录的资源使用量进行叠加处理,即调用次数进行叠加,得到如图3b中第一条所示的调用记录。图3a中的第5条和第6条API调用记录的合并方法与上述的前4条API调用记录的合并方法是一样的,此处不再赘述。
进一步的,管理单元45还用于对所述多条API调用记录进行过滤处理,滤除位于所述多条API调用记录中计费单价为零的API调用记录。
参见附图3a,该表中的最后两条API调用记录是免费的,或者说,API计费网关预设的计费单价为零,所以不需要API计费网关进行计费处理,所以滤除该最后两条API调用记录,不会对计费结果产生影响。
由上可知,在本发明实施例提供一种API调用记录的管理装置中,管理单元45用于根据预设的计费单价,将多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同计费单价的两条以上API调用记录的资源使用量进行叠加处理,得到经过叠加处理的一条API调用记录。采用该装置,能够在不影响计费结果正确性的前提下,减少了API计费网关需要进行计费处理的API调用记录的数目,释放出了部分处理资源。
作为本发明的另一个实施例,所述多条API调用记录中的每一条API调用记录均还包括下述属性信息:API标识,所述API标识用于表示被调用的API;
管理单元45具体用于将所述多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同API标识的两条以上API调用记录中每一API调用记录的资源使用量进行叠加处理,并得到经过叠加处理后的一条API调用记录。
需要说明的是,“具有相同API标识”和“具有相同的计费单价”是不 同的,它们之间存在下述关系:位于同一计费周期、具有相同调用者标识且具有相同API标识的两条以上API调用记录必然具有相同的计费单价,但是,位于同一计费周期、具有相同调用者标识且具有相同的计费单价的两条以上API调用记录并不一定具有相同的API标识。
进一步的,由于位于同一计费周期、具有相同调用者标识且具有相同API标识的两条以上API调用记录必然具有相同的计费单价,所生意管理单元45将符合该条件的两条以上API调用记录的资源使用量进行叠加,而不必考虑API计费网关中预设的计费单价。
值得注意的是,按照所述计费单价对所述经过叠加处理后的一条API调用记录进行计费得到的计费结果,与,按照所述计费单价,对所述多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同API标识的两条以上API调用记录进行计费得到的计费结果,是相同的。
由上可知,本发明实施例提供一种API调用记录的管理装置,相对于前一实施例提供的管理装置来说,管理单元45具体用于将所述多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同API标识的两条以上API调用记录中每一API调用记录的资源使用量进行叠加处理,并得到经过叠加处理后的一条API调用记录。采用该方案,能够在不影响计费结果正确性的前提下,减少了API计费网关需要进行计费处理的API调用记录的数目,释放出了部分处理资源。进一步的,本发明实施例提供的API调用记录的管理装置,不依赖于计费单价,所以更加简单、容易实现。
实施例三
参见附图5,为本发明实施例提供的一种网关500的结构示意图,该网关500是实施例二所述的API调用记录的管理装置的运行载体,应当理解的是,该网关500可以用在图1所示的应用场景图中。需要说明的是,在API网关为实施例二所述的API调用记录的管理装置的运行载体时,网关 500即指API网关;在API计费网关为实施例二所述的API调用记录的管理装置的运行载体时,网关500即指API计费网关;当然,网关500也可是API网关和API计费网关之外的其他网关。
具体的,如图5所示,网关500可以包括至少一个处理器501,例如CPU,至少一个网络接口504,例如物理网卡,或者其他的用户接口503,以及存储器505和至少一个通信总线502。
其中,通信总线502用于实现这些组件之间的连接通信。
网络接口504用于实现该网关500和网络之间的连接通信,比如所述控制设备500通过所述网络接口504连接物理网卡和/或物理交换机等设备,以便于接收其他网络设备发送的数据。可选的,用户接口503,可以包括显示器,键盘或者其他点击设备,例如,鼠标,轨迹球(trackball),触感板或者触感显示屏等。
存储器605可能包括高速随机存取记忆体(RAM,Random Access Memory),也可能还包括非不稳定的存储器(non-volatile memory),例如至少一个磁盘存储器。可选的,该存储器605还可以包括至少一个位于远离前述处理器501的存储装置。在一些实施方式中,存储器505存储了如下的元素,可执行模块或者数据结构,或者他们的子集,或者他们的扩展集:操作系统5051,包含各种系统程序,用于实现各种基础业务以及处理基于硬件的任务;应用模块5052,包含各种应用程序,用于实现各种应用业务。在网关500中,应用模块5052中包括但不限于实施例二所述的API调用记录的管理装置包括的获取单元、确定单元和管理单元。
需要说明的是,处理器501用于实现实施例二所述的API调用记录的管理装置的所有功能,此处不再赘述,具体内容参见实施例二。
可知,本发明实施例提供一种网关,该网关为实施例所述的API调用记录的管理装置的运行载体,基于该网关,能够根据预设的计费单价,将多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同 计费单价的两条以上API调用记录的资源使用量进行叠加处理,得到经过叠加处理的一条API调用记录。从而在不影响计费结果正确性的前提下,减少了API计费网关需要进行计费处理的API调用记录的数目,释放出了部分处理资源。
实施例四
参见附图6,为本发明实施例提供的一种API调用记录的管理系统的结构示意图,该API调用记录的管理系统可用于图1所示的应用场景中。且该API调用记录的管理系统中的API调用记录的管理装置的具体功能参见实施例二即可,此处不再赘述。
具体的额,如图6所示的API调用记录的管理系统中,所述API网关用于产生所述API调用记录的管理装置获取的所述多条API调用记录;所述API计费网关用于对所述API调用记录的管理装置叠加处理后的一条API调用记录,按照所述预设的计费单价进行计费。
优选的,所述API调用记录的管理装置集成在所述API网关,或者,所述API调用记录的管理装置集成在所述API计费网关。
本发明实施例提供一种API调用记录的管理系统,基于该API调用记录的管理系统,能够根据预设的计费单价,将多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同计费单价的两条以上API调用记录的资源使用量进行叠加处理,得到经过叠加处理的一条API调用记录。从而在不影响计费结果正确性的前提下,减少了API计费网关需要进行计费处理的API调用记录的数目,释放出了部分处理资源。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和 方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应所述以权利要求的保护范围为准。

Claims (14)

  1. 一种应用程序编程接口API调用记录的管理方法,其特征在于,包括:
    获取多条API调用记录,所述多条API调用记录中的每一条API调用记录均至少包括下述属性信息:调用者标识、调用时刻Called time和资源使用量,其中,所述调用者标识用于表示所述API的调用者,所述Called time用于表示所述API被调用的时刻信息;
    根据所述多条API调用记录中每条API调用记录的Called time,确定所述多条API调用记录中每条API调用记录各自所属的计费周期;
    根据预设的计费单价,将所述多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同的计费单价的两条以上API调用记录中每一API调用记录的资源使用量进行叠加处理,并得到经过叠加处理后的一条API调用记录。
  2. 根据权利要求1所述的方法,其特征在于:
    按照所述计费单价对所述经过叠加处理后的一条API调用记录进行计费得到的计费结果,与,按照所述计费单价,对所述多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同的计费单价的两条以上API调用记录进行计费得到的计费结果,是相同的。
  3. 根据权利要求1或2所述的方法,其特征在于,
    所述多条API调用记录中的每一条API调用记录均还包括下述属性信息:API标识,所述API标识用于表示被调用的API;
    所述根据预设的计费单价,将所述多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同的计费单价的两条以上API调用记录中每一API调用记录的资源使用量进行叠加处理,并得到经过叠加处理后的一条API调用记录,具体包括:
    将所述多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同API标识的两条以上API调用记录中每一API调用记录的资源 使用量进行叠加处理,并得到经过叠加处理后的一条API调用记录。
  4. 根据权利要求3所述的方法,其特征在于:
    按照所述计费单价对所述经过叠加处理后的一条API调用记录进行计费得到的计费结果,与,按照所述计费单价,对所述多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同API标识的两条以上API调用记录进行计费得到的计费结果,是相同的。
  5. 根据权利要求1至4任一项所述的方法,其特征在于,所述方法还包括:
    对所述多条API调用记录进行过滤处理,滤除位于所述多条API调用记录中计费单价为零的API调用记录。
  6. 根据权利要求1至5所述的方法,其特征在于:
    所述计费单价为调用所述API单位时长的价格、调用所述API单位次数的价格、调用所述API获取的单位数据流量的价格或调用所述API获取的单位存储空间的价格。
  7. 一种应用程序编程接口API调用记录的管理装置,其特征在于,包括:
    获取单元,用于获取多条API调用记录,所述多条API调用记录中的每一条API调用记录均至少包括下述属性信息:调用者标识、调用时刻Called time和资源使用量,其中,所述调用者标识用于表示所述API的调用者,所述Called time用于表示所述API被调用的时刻信息;
    确定单元,用于根据所述多条API调用记录中每条API调用记录的Called time,确定所述多条API调用记录中每条API调用记录各自所属的计费周期;
    管理单元,用于根据预设的计费单价,将所述多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同的计费单价的两条以上API调用记录中每一API调用记录的资源使用量进行叠加处理,并得到经过叠加处理后的一条API调用记录。
  8. 根据权利要求7所述的装置,其特征在于:
    按照所述计费单价对所述经过叠加处理后的一条API调用记录进行计费得到的计费结果,与,按照所述计费单价,对所述多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同的计费单价的两条以上API调用记录进行计费得到的计费结果,是相同的。
  9. 根据权利要求7或8所述的装置,其特征在于:
    所述多条API调用记录中的每一条API调用记录均还包括下述属性信息:API标识,所述API标识用于表示被调用的API;
    所述管理单元具体用于将所述多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同API标识的两条以上API调用记录中每一API调用记录的资源使用量进行叠加处理,并得到经过叠加处理后的一条API调用记录。
  10. 根据权利要求9所述的装置,其特征在于:
    按照所述计费单价对所述经过叠加处理后的一条API调用记录进行计费得到的计费结果,与,按照所述计费单价,对所述多条API调用记录中位于同一计费周期、具有相同调用者标识且具有相同API标识的两条以上API调用记录进行计费得到的计费结果,是相同的。
  11. 根据权利要求7至10任一项所述的装置,其特征在于:
    所述管理单元还用于对所述多条API调用记录进行过滤处理,滤除位于所述多条API调用记录中计费单价为零的API调用记录。
  12. 根据权利要求7至11任一项所述的装置,其特征在于:
    所述计费单价为调用所述API单位时长的价格、调用所述API单位次数的价格、调用所述API获取的单位数据流量的价格或调用所述API获取的单位存储空间的价格。
  13. 一种应用程序编程接口API调用记录的管理系统,其特征在于,包括API网关、API计费网关和如权利要求7至12任一项所述的API调用记录的管理装置:
    所述API网关用于产生所述API调用记录的管理装置获取的所述多条API调用记录;
    所述API计费网关用于对所述API调用记录的管理装置叠加处理后的一条API调用记录,按照所述预设的计费单价进行计费。
  14. 根据权利要求13所述的管理系统,其特征在于:
    所述API调用记录的管理装置集成在所述API网关,或者,所述API调用记录的管理装置集成在所述API计费网关。
PCT/CN2015/099160 2015-01-04 2015-12-28 一种应用程序编程接口api调用记录的管理方法和装置 WO2016107510A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510003882.1A CN104506371A (zh) 2015-01-04 2015-01-04 一种应用程序编程接口api调用记录的管理方法和装置
CN201510003882.1 2015-01-04

Publications (1)

Publication Number Publication Date
WO2016107510A1 true WO2016107510A1 (zh) 2016-07-07

Family

ID=52948086

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/099160 WO2016107510A1 (zh) 2015-01-04 2015-12-28 一种应用程序编程接口api调用记录的管理方法和装置

Country Status (2)

Country Link
CN (1) CN104506371A (zh)
WO (1) WO2016107510A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10756911B2 (en) 2018-05-10 2020-08-25 International Business Machines Corporation Cost estimation on a cloud-computing platform
EP3839846A1 (en) * 2019-12-20 2021-06-23 Fujitsu Limited Service cost calculation device, method, and program
CN114679459A (zh) * 2022-05-07 2022-06-28 阿里巴巴(中国)有限公司 云函数的调用方法和装置

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104506371A (zh) * 2015-01-04 2015-04-08 华为技术有限公司 一种应用程序编程接口api调用记录的管理方法和装置
CN108469956B (zh) * 2017-02-23 2022-01-11 京瓷办公信息系统株式会社 图像形成装置、管理服务器和信息处理方法
CN109428753A (zh) * 2017-08-29 2019-03-05 西门子公司 计量指标获取方法、服务调用记录获取方法及装置
CN109787780B (zh) * 2017-11-10 2021-08-31 华为技术有限公司 基于api内容的计费方法及能力开放功能实体
CN109949064B (zh) * 2017-12-20 2021-09-03 北京京东尚科信息技术有限公司 一种开放接口调用计费方法和装置
CN111274248A (zh) * 2020-01-19 2020-06-12 北京金堤科技有限公司 一种计费数据的生成方法及装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101667920A (zh) * 2008-09-03 2010-03-10 中国移动通信集团上海有限公司 一种计费方法、系统及话单生成设备
CN102202281A (zh) * 2010-03-24 2011-09-28 中兴通讯股份有限公司 话单处理方法及系统
US20140165199A1 (en) * 2012-07-16 2014-06-12 Tencent Technology (Shenzhen) Company Limited Method and apparatus for determining malicious program
CN104506371A (zh) * 2015-01-04 2015-04-08 华为技术有限公司 一种应用程序编程接口api调用记录的管理方法和装置

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101496387B (zh) * 2006-03-06 2012-09-05 思科技术公司 用于移动无线网络中的接入认证的系统和方法
CN102065057B (zh) * 2009-11-18 2014-07-16 华为技术有限公司 一种应用于Widget的代理服务的方法及服务器
CN102387486B (zh) * 2010-09-06 2015-02-04 中国移动通信集团河北有限公司 Gprs分割话单的计费方法及装置
CN102573112B (zh) * 2010-12-07 2015-01-14 中国电信股份有限公司 电信网络能力开放方法、系统及联盟支撑平台
US8458808B2 (en) * 2011-01-07 2013-06-04 Mastercard International Incorporated Premium access to open application programming interface systems and methods
CN103269479B (zh) * 2013-05-07 2016-03-30 华为技术有限公司 一种话单处理方法、装置和系统
CN104144069B (zh) * 2013-05-10 2018-02-06 中国电信股份有限公司 无线侧呼叫数据记录与用户业务行为关联的方法和装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101667920A (zh) * 2008-09-03 2010-03-10 中国移动通信集团上海有限公司 一种计费方法、系统及话单生成设备
CN102202281A (zh) * 2010-03-24 2011-09-28 中兴通讯股份有限公司 话单处理方法及系统
US20140165199A1 (en) * 2012-07-16 2014-06-12 Tencent Technology (Shenzhen) Company Limited Method and apparatus for determining malicious program
CN104506371A (zh) * 2015-01-04 2015-04-08 华为技术有限公司 一种应用程序编程接口api调用记录的管理方法和装置

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10756911B2 (en) 2018-05-10 2020-08-25 International Business Machines Corporation Cost estimation on a cloud-computing platform
EP3839846A1 (en) * 2019-12-20 2021-06-23 Fujitsu Limited Service cost calculation device, method, and program
US11646904B2 (en) 2019-12-20 2023-05-09 Fujitsu Limited Information processing apparatus and service cost calculation method
CN114679459A (zh) * 2022-05-07 2022-06-28 阿里巴巴(中国)有限公司 云函数的调用方法和装置
CN114679459B (zh) * 2022-05-07 2024-03-12 阿里巴巴(中国)有限公司 云函数的调用方法和装置

Also Published As

Publication number Publication date
CN104506371A (zh) 2015-04-08

Similar Documents

Publication Publication Date Title
WO2016107510A1 (zh) 一种应用程序编程接口api调用记录的管理方法和装置
US8793359B1 (en) Systems and/or methods for intelligently detecting API key domains
US9571419B2 (en) Secure metering and accounting for cloud services
US10747717B2 (en) Method and system for applying data retention policies in a computing platform
WO2017041657A1 (zh) 一种应用接口管理方法和装置
WO2022068761A1 (zh) 数据处理方法、装置、电子设备及存储介质
US20200090096A1 (en) Resource management system, management device, method, and program
CN103559118A (zh) 一种基于aop与注解信息系统的安全审计方法
WO2020000726A1 (zh) 性能测试报告的生成方法、电子装置及可读存储介质
CN109189367A (zh) 一种数据处理方法、装置、服务器及存储介质
US20120005330A1 (en) Organizing Individual Java Client Request Flows into a Single Server Transaction
CN103729176A (zh) 应用程序整合方法及装置
US20200097559A1 (en) Graphql management layer
CN108900482A (zh) 脚本的执行方法、服务器管理系统及存储介质
CN103513990A (zh) 一种用于分布式处理的高性能通用网络框架的设计方法
CN102930046B (zh) 数据处理方法、计算节点及系统
JP2011513842A5 (zh)
CN101667935A (zh) 一种网络边界安全监控方法
CN110751483A (zh) 基于区块链的财务记账冲销方法及装置和电子设备
CN104679865B (zh) 将Web页面集成作为服务进行注册和监控的方法
JPWO2020240812A5 (zh)
WO2023082032A1 (zh) 一种云平台参数适配方法、装置、终端设备及储存介质
CN113269547B (zh) 数据处理方法、装置、电子设备和存储介质
US11720667B2 (en) Stateful microservice-aware intrusion detection
WO2018233308A1 (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: 15875187

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: 15875187

Country of ref document: EP

Kind code of ref document: A1