CN110135892A - Calling charging method, device, electronic equipment and the storage medium of API - Google Patents
Calling charging method, device, electronic equipment and the storage medium of API Download PDFInfo
- Publication number
- CN110135892A CN110135892A CN201910300884.5A CN201910300884A CN110135892A CN 110135892 A CN110135892 A CN 110135892A CN 201910300884 A CN201910300884 A CN 201910300884A CN 110135892 A CN110135892 A CN 110135892A
- Authority
- CN
- China
- Prior art keywords
- calling
- api
- target api
- effect
- charging
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/547—Remote procedure calls [RPC]; Web services
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q30/00—Commerce
- G06Q30/02—Marketing; Price estimation or determination; Fundraising
- G06Q30/0283—Price estimation or determination
Landscapes
- Engineering & Computer Science (AREA)
- Business, Economics & Management (AREA)
- Development Economics (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Accounting & Taxation (AREA)
- Finance (AREA)
- Software Systems (AREA)
- Strategic Management (AREA)
- General Physics & Mathematics (AREA)
- Entrepreneurship & Innovation (AREA)
- General Business, Economics & Management (AREA)
- Marketing (AREA)
- Economics (AREA)
- Game Theory and Decision Science (AREA)
- General Engineering & Computer Science (AREA)
- Telephonic Communication Services (AREA)
Abstract
The embodiment of the invention discloses calling charging method, device, electronic equipment and the storage mediums of a kind of API.The described method includes: receiving API Calls request, obtain the initial data carried in API Calls request, API Calls request call target API is responded to handle initial data, obtain result data, based on initial data and result data, the calling effect for obtaining target API carries out charging based on calling of the calling effect to target API.The present invention is according to initial data and by calling API to obtain the calling effect of target API to the result data that original data processing obtains, charging is carried out based on calling of the calling effect to target API, to accurately carry out charging to the calling of API, promote the promotion of API service quality.
Description
Technical field
The present invention relates to artificial intelligence fields, set more particularly, to the calling charging method of API a kind of, device, electronics
Standby and storage medium.
Background technique
With the development and propulsion of artificial intelligence technology, the application programming interface of cloud artificial intelligence function
(Application Programming Interface, API) is widely used, and artificial intelligence cloud platform uses tradition
The relevant framework of cloud computing assess intelligent algorithm.Traditional cloud computing is rule-based, is determining, each cloud
API Calls return the result is that stablizing available.But artificial intelligence function be it is based on probability, being not can in any occasion
Reach the performance of stable uniform, therefore a current insoluble problem is also become for the charging of API Calls, is badly in need of one kind
More fair charging mode.
Summary of the invention
In view of the above problems, the embodiment of the present invention propose the calling charging method of API a kind of, device, electronic equipment with
And storage medium, to improve the above problem.
In a first aspect, the embodiment of the invention provides the calling charging methods of API a kind of, which comprises receive API
Call request obtains the initial data carried in the API Calls request;Respond API pairs of target of the API Calls request call
The initial data is handled, and result data is obtained;Based on the initial data and the result data, the target is obtained
The calling effect of API;Charging is carried out based on calling of the calling effect to the target API.
Second aspect, the embodiment of the invention provides the calling message accounting of API a kind of, described device includes: reception mould
Block obtains the initial data carried in the API Calls request for receiving API Calls request;Processing module, for responding
The API Calls request call target API handles the initial data, obtains result data;Module is obtained, base is used for
In the initial data and the result data, the calling effect of the target API is obtained;Accounting module, for based on described
Effect is called to carry out charging to the calling of the target API.
The third aspect, the embodiment of the invention provides a kind of electronic equipment, including one or more processors and storage
Device;One or more programs, wherein one or more of programs are stored in the memory and are configured as by described
One or more processors execute, and one or more of programs are configured to carry out above-mentioned method.
Fourth aspect, it is described computer-readable the embodiment of the invention provides a kind of computer-readable storage medium
Program code is stored in storage medium, said program code can be called by processor and execute the above method.
The embodiment of the invention discloses calling charging method, device, electronic equipment and the storage mediums of a kind of API.It connects
API Calls request is received, the initial data carried in API Calls request is obtained, responds API pairs of target of the API Calls request call
Initial data is handled, and result data is obtained, and is based on initial data and result data, obtains the calling effect of target API, base
Charging is carried out in calling of the calling effect to target API.To according to initial data and by call API to initial data at
Reason obtains the calling effect that result data obtains target API, carries out charging based on calling of the calling effect to target API, thus
Charging accurately is carried out to the calling of API, promotes the promotion of API service quality.
The aspects of the invention or other aspects can more straightforwards in the following description.
Detailed description of the invention
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment
Attached drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the invention, for
For those skilled in the art, without creative efforts, it can also be obtained according to these attached drawings other attached
Figure.
Fig. 1 shows the flow diagram of the calling charging method of API provided in an embodiment of the present invention;
Fig. 2 shows the flow diagrams of the calling charging method of the API of one embodiment of the invention offer;
Fig. 3 shows the stream of the step S250 of the calling charging method for the API that embodiment shown in Fig. 2 of the invention provides
Journey schematic diagram;
Fig. 4 shows the flow diagram of the calling charging method of the API of further embodiment of this invention offer;
Fig. 5 show another embodiment of the present invention provides API calling charging method flow diagram;
Fig. 6 shows the flow diagram of the calling charging method of the API of yet another embodiment of the invention offer;
Fig. 7 shows the one of the step S540 of the calling charging method for the API that embodiment shown in fig. 6 of the invention provides
A flow diagram;
Fig. 8 shows the another of the step S540 of the calling charging method for the API that embodiment shown in fig. 6 of the invention provides
One flow diagram;
Fig. 9 shows the structural block diagram of the calling message accounting of API provided in an embodiment of the present invention;
Figure 10 shows the electricity of calling charging method of the embodiment of the present invention for executing API according to an embodiment of the present invention
The structural block diagram of sub- equipment;
Figure 11 show the embodiment of the present invention for saving or carry the tune for realizing API according to an embodiment of the present invention
With the storage unit of the program code of charging method.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
With the development and propulsion of artificial intelligence technology, the API of cloud artificial intelligence function is widely used, manually
Intelligent cloud platform assesses intelligent algorithm using the relevant framework of traditional cloud computing.Traditional cloud computing is rule-based
, be it is determining, each cloud API Calls return the result is that stablizing available.But artificial intelligence function be it is based on probability,
It is not to be attained by the performance of stable uniform in any occasion, therefore a current hardly possible is also become for the charging of API Calls
To solve the problems, such as.
Currently, cloud artificial intelligence platform, the charging of artificial intelligence API, be completely with call number charging, but it is related
Whether function is really realized, if really can satisfy customer demand or unknown.With this tune for not knowing about effect completely
With, come charging, being more coarse, inaccurate based on number.
Based on the above issues, inventor has found after the calling charging method to current API has carried out a series of researchs, is
Solve the problems, such as according only to call number charging, can regular sampling analysis cloud API Calls success rate, calculate practical call
Effect, and carry out charging.On the one hand charging can be allowed more accurate, on the other hand can also promotes the competition of API algorithm and mention
It is high.
Then, present inventors have proposed the calling charging method of API provided in an embodiment of the present invention, device, electronic equipments
And storage medium, according to initial data and by calling API to obtain target to the result data that original data processing obtains
The calling effect of API, based on calling effect to carry out charging to the calling of target API, to accurately be counted to the calling of API
Take, promotes the promotion of API service quality.
Various embodiments of the present invention are specifically described below in conjunction with attached drawing.
The calling charging method of API can be executed by electronic equipment, and electronic equipment may include terminal, server,
Mainly each embodiment is illustrated by taking server as an example in following embodiment.Referring to Fig. 1, Fig. 1 shows implementation of the present invention
The flow diagram of the calling charging method for the API that example provides.Below detailed explain will be carried out for embodiment shown in FIG. 1
It states, the method can specifically include following steps:
Step S110: receiving API Calls request, obtains the initial data carried in the API Calls request.
In the present embodiment, server is received is requested by the API Calls that user issues, and API Calls request may include having tune
Type, initial data of carrying of API etc..Then, server can further obtain the original carried in API Calls request
Beginning data, wherein initial data can be the data for being inputted by user or being uploaded, for example, when user wants to carry out speech recognition,
The call request for calling the API of speech recognition can be sent, wherein the initial data carried in the request can be user's input
Or the recording uploaded.
Step S120: it responds the API Calls request call target API and the initial data is handled, tied
Fruit data.
In the present embodiment, based on the API Calls request received, server can respond API Calls request call mesh
API is marked, initial data is sent to target API and is handled, to obtain result data.For example, based on speech recognition is called
API call request, the recording that server can call the API of speech recognition to upload user, i.e. initial data are known
Not, so as to the text i.e. result data after being identified.
Step S130: it is based on the initial data and the result data, obtains the calling effect of the target API.
In the present embodiment, it after getting initial data and result data, is called in order to allow user to know
Target API algorithm superiority and inferiority, server can obtain the calling effect of target API based on initial data and result data,
Wherein, effect is called then to can reflect the superiority and inferiority of target API algorithm.It is possible to further by initial data and result data
It compares, it is hereby achieved that the calling effect of target API.
Step S140: charging is carried out based on calling of the calling effect to the target API.
In the present embodiment, whether correlation function can be realized according to invocation target API, or whether is able to satisfy user demand
Deng calling effect based on charging is carried out to the calling of target API, be a kind of more fair charging mode.Then server
Charging can be carried out according to calling of the calling effect to target API, wherein call effect when obtaining the calling effect of target API
The superiority and inferiority of fruit can be positively correlated with the expense of charging.For example, when the calling effect of invocation target API is 80%, charging unit price
It can be 0.12 yuan, if the calling effect of invocation target API is 90%, charging unit price can be 0.18 yuan.
Further, when the equipment of invocation target API has multiple, multiple equipment can be obtained respectively to target API's
Effect is called, further obtains and averagely calls effect, it then can be according to the progress charging of average callings effect when charging.It can also divide
Not Huo get multiple equipment to the calling effect of target API after, respectively carry out charging finally summarized again.
The calling charging method of API provided in an embodiment of the present invention receives API Calls request, obtains in API Calls request
The initial data of carrying responds API Calls request call target API and handles initial data, obtains result data, base
In initial data and result data, the calling effect of target API is obtained, based on calling effect to carry out the calling of target API
Take.To according to initial data and by calling API to obtain the tune of target API to the result data that original data processing obtains
Charging accurately is carried out to the calling of API, promotes API based on being called effect to carry out charging to the calling of target API with effect
The promotion of service quality.
Referring to Fig. 2, Fig. 2 shows the flow diagrams of the calling charging method of the API of one embodiment of the invention offer.
It will be explained in detail below for process shown in Fig. 2, the method can specifically include following steps:
Step S210: receiving API Calls request, obtains the initial data carried in the API Calls request.
Step S220: it responds the API Calls request call target API and the initial data is handled, tied
Fruit data.
Step S230: it is based on the initial data and the result data, obtains the calling effect of the target API.
Wherein, the specific descriptions of step S210- step S230 please refer to step S110- step S130, and details are not described herein.
Step S240: the call number of the target API is obtained.
In the present embodiment, the record of calling can be saved after API is called, server is then available to arrive the target
The call number of API.
Step S250: charging is carried out to the calling of the target API based on the calling effect and the call number.
In the present embodiment, charging is carried out to the calling of target API, it can be simultaneously based on calling effect and call number two
A index, so as to more acurrate carry out charging.For example, when the calling effect of invocation target API is 85%, the target that gets
The call number of API is 50,000 times, and every ten thousand expenses are 0.04 yuan/ten thousand times, then can be every according to calling effect * call number *
Ten thousand expense=85%*5*0.04 charging modes carry out charging to the calling of target API.When the equipment of invocation target API is
When multiple, charging can also be carried out according to averagely calling effect and call number.
Further, in the present embodiment, referring to Fig. 3, Fig. 3 shows embodiment shown in Fig. 2 offer of the invention
API calling charging method step S250 flow diagram.Below detailed explain will be carried out for process shown in Fig. 3
It states, in the present embodiment, the method can specifically include following steps:
Step S251: the default metering period of the target API is obtained.
In the present embodiment, default metering period can be set in charge system, be used for conveniently, periodically to target
The calling of API carries out charging.Default metering period, which can be, to be scheduled to last with week, is scheduled to last with the moon, to schedule to last in year etc., can be by system
It automatically generates or is arranged by system personnel.And further, when the number of devices of invocation target API is too many, preset charging week
Phase can accordingly be reduced, so that the workload of server is reduced, for example, former default metering period is to schedule to last with the moon, but call
The equipment of target API reaches 300, then can be changed to schedule to last with week by metering period.
Step S252: call number of the target API in the default metering period is obtained.
In the present embodiment, call number of the available target API of server in default metering period.For example, should
The default metering period of target API is with moon charging, if it is desired to charging is carried out to the calling of target API in March, it is available
The call number of entire target API in March.
Step S253: based on the call number in the default metering period of calling effect and the target API,
Charging is carried out to expense of the target API in the default metering period.
In the present embodiment, charging is carried out to the expense in metering period, can be existed according to calling effect and target API
Call number in default metering period carries out charging.For example, the calling charging to target API in March, the mesh within entire March
The call number for marking API is 50,000 times, and charging unit price is 0.04/ ten thousand times/month, and calling effect is 85%, then can be according to tune
The calling of entire target in March API is counted with effect * call number * charging unit price=85%*5*0.04 charging mode
Take.
The calling charging method for the API that one embodiment of the invention provides receives API Calls request, obtains the API Calls and ask
The initial data for asking middle carrying responds API Calls request call target API and is handled initial data to obtain number of results
According to, and the calling effect based on initial data and result data acquisition target API, the call number of target API is obtained, based on tune
Charging is carried out to the calling of target API with effect and call number.Calling charging method compared to API shown in FIG. 1, this reality
The call number of target API can also be obtained by applying example, based on calling effect and call number to carry out the calling of target API
Take, to increase this index of call number when carrying out charging, so that charging is more acurrate.
Referring to Fig. 4, Fig. 4 shows the process signal of the calling charging method of the API of further embodiment of this invention offer
Figure.It will be explained in detail below for process shown in Fig. 4, when the quantity for the equipment for calling the target API is multiple
When, the method can specifically include following steps:
Step S310: at least partly equipment in multiple equipment is determined as sampling device.
In the present embodiment, at least partly equipment in multiple equipment can be determined as sampling device by server, wherein
The mode that stratified sampling can be taken extracts a certain number of equipment from different equipment layerings and is determined as sampling device, example
Such as, the call number that can obtain each equipment calls target API of multiple equipment respectively, can be with according to different call numbers
It is layered as different equipment, multiple equipment involved in citing can be divided into three layers according to call number, and call number is 5,000
Secondary, call number is 10,000 times and call number is 20,000 times, wherein call number is that 5,000 equipment has 50, is called
Number is that 10,000 equipment has 100, and call number is that 20,000 equipment has 150, then can be according to the side of stratified sampling
Formula extracts 10 equipment as sampling device from 50 equipment that call number is 5,000 times, is 10,000 times from call number
20 equipment are extracted in 100 equipment as sampling device, are extracted 30 from 150 equipment that call number is 20,000 times and are set
It is standby to be used as sampling device.It is further possible to which the mode of random sampling is taken to determine sampling device, wherein sampling device is extremely
It can be the equipment for being able to record initial data less.
Step S320: the target API is obtained in the calling effect of the sampling device.
In the present embodiment, calling effect of the available target API of server in sampling device, wherein sampling device
Calling effect can be obtained according to the method for above-mentioned steps S110 and step S120.
Step S330: based on the target API in the calling effect of the sampling device, the tune of the target API is determined
Use Freight Basis.
In the present embodiment, can according to target API sampling device calling effect, to determine the calling of target API
Freight Basis can carry out charging with the average calling effect of the calling effect of sampling device equipment as a whole with this.For example, taking out
The calling effect of sample equipment is 80%, and the unit price of corresponding charging can be 0.12 yuan, then the calling Freight Basis of target API can
To be to carry out charging with 0.12 yuan of unit price.
The method of the calling charging for the API that further embodiment of this invention provides, by at least partly equipment in multiple equipment
Be determined as sampling device, obtain target API in the calling effect of the sampling device, based on target API the sampling device tune
With effect, the calling Freight Basis of target API is determined.Calling charging method compared to API shown in FIG. 1, the present embodiment is also
Sampling device can be determined in the multiple equipment for calling API, and the calling of target API is determined according to the calling effect of sampling device
Freight Basis reduces cost to reduce the workload of system.
Referring to Fig. 5, Fig. 5 show another embodiment of the present invention provides API calling charging method process signal
Figure.It will be explained in detail below for process shown in fig. 5, the method can specifically include following steps:
Step S410: receiving API Calls request, obtains the initial data carried in the API Calls request.
Step S420: it responds the API Calls request call target API and the initial data is handled, tied
Fruit data.
Wherein, the specific descriptions of step S410- step S420 please refer to step S110- step S120, and details are not described herein.
Step S430: handling the initial data by designated treatment mode, obtain reference result data,
In, the designated treatment mode is different from the invocation target API.
In the present embodiment, the calling effect of target API, server can be by with invocation target API's in order to obtain
The different designated treatment mode of mode handles initial data, so as to obtain reference result data, wherein can be
By artificial treatment, for example, can be obtained by manually identifying the voice content of the recording of user's upload with reference to recognition result.It is specified
Processing mode is also possible to be handled by cloud or the stronger system of operational capability, for example, for the picture that user uploads, it can
The picture is uploaded to cloud, reference result data are obtained by the content of cloud identification picture.
Step S440: the reference result data and the result data are compared, and obtain the tune of the target API
Use effect.
In the present embodiment, the reference result data that server can will be handled by designated treatment mode, with
The result data for calling API to obtain compares, to obtain the calling effect of target API.For example, the API tune that user sends
It is speech recognition with request, and the initial data carried is recording, after obtaining the result data for calling API to obtain, then passes through people
Work identifies that the recording obtains reference result data, wherein two data can all be text information, then can compare two texts
The accounting of the identical number of words of information.
Step S450: charging is carried out based on calling of the calling effect to the target API.
Wherein, the specific descriptions of step S450 please refer to step S140, and details are not described herein.
Another embodiment of the present invention provides API calling charging method, receive API Calls request, obtain the API tune
With the initial data carried in request, responds API Calls request call target API and initial data is handled, tied
Fruit data are handled initial data by designated treatment mode, obtain reference result data, wherein designated treatment mode
It is different from invocation target API, reference result data and result data are compared, the calling effect of target API is obtained, is based on
Effect is called to carry out charging to the calling of target API.Calling charging method compared to API shown in FIG. 1, the present embodiment may be used also
Initial data is handled in a manner of through designated treatment to obtain reference result data, according to reference result data and number of results
According to comparison obtain the calling effect of target API, so as to obtaining more accurately calling effect.
Referring to Fig. 6, Fig. 6 shows the process signal of the calling charging method of the API of yet another embodiment of the invention offer
Figure.It will be explained in detail below for process shown in fig. 6, the method can specifically include following steps:
Step S510: receiving API Calls request, obtains the initial data carried in the API Calls request.
Step S520: it responds the API Calls request call target API and the initial data is handled, tied
Fruit data.
Step S530: it is based on the initial data and the result data, obtains the calling effect of the target API.
Wherein, the specific descriptions of step S510- step S530 please refer to step S110- step S130, and details are not described herein.
Step S540: charging is carried out based on calling of the calling effect to the target API.
In the present embodiment, referring to Fig. 7, Fig. 7 shows the tune for the API that embodiment shown in fig. 6 of the invention provides
With a flow diagram of the step S530 of charging method.It will be explained in detail below for process shown in Fig. 7, at this
In embodiment, the method can specifically include following steps:
Step S541A: the achievement data of the target API is obtained, wherein the achievement data, which includes at least, calls delay
And bandwidth occupancy.
In the present embodiment, the superiority and inferiority of API algorithm can be analyzed based on other achievement datas, for example called and prolonged
Late, bandwidth occupancy, runing time etc..The achievement data that server then can further obtain target API carries out Freight Basis
Adjustment, wherein achievement data, which includes at least, calls delay and bandwidth occupancy.
Step S542A: charging is carried out to the calling of the target API based on the calling effect and the achievement data.
In the present embodiment, server can count the calling of target API according to calling effect and achievement data
Take, wherein Freight Basis is called in available achievement data adjustment, counts in conjunction with calling effect to the calling of target API
Take.For example, the response time of target API is 0.2 second, it is higher than the general response time, then Freight Basis can be called from 0.18
Member/ten thousand reductions by 0.16 yuan/ten thousand times, carries out charging in conjunction with calling effect.
Further, referring to Fig. 8, Fig. 8 shows the calling meter for the API that embodiment shown in fig. 6 of the invention provides
The another flow diagram of the step S530 of charging method.It will be explained in detail below for process shown in Fig. 8, in this reality
It applies in example, the method can specifically include following steps:
Step S541B: judge whether the calling effect is lower than effect threshold value.
In the present embodiment, when the calling of invocation target API is ineffective, user experience is bad for a user
, it is that the displeased calling for API is paid naturally, then, server, which may determine that, calls whether effect is lower than effect threshold
Value, to adjust the calling Freight Basis to target API, wherein effect threshold value can be to be preset by server, can also be by
The payment collector of target API is arranged.
Step S542B: when the calling effect is lower than the effect threshold value, the calling charging of the target API is reduced
Standard.
In the present embodiment, when calling effect to be lower than effect threshold value, server can reduce the calling charging of target API
Standard, for example, by taking speech recognition as an example, the corresponding discrimination for calling effect that can be presented as text of speech recognition API, originally
The calling Freight Basis of the API be 0.18/ ten thousand times, when the API calling effect be 60%, be lower than effect threshold value 65% when, can
Freight Basis will be called to be reduced to 0.15/ ten thousand times.It is understood that when the calling effect of target API is well below calling
It when threshold value, that is, indicates that target API algorithm is unable to satisfy user demand, then can not even pay to target API.
Step S543B: charging is carried out based on calling of the calling Freight Basis after reduction to the target API.
In the present embodiment, for calling ineffective target API, server then can be according to the calling meter after reduction
Take standard and charging is carried out to the calling of target API.For example, for the speech recognition API mentioned in above-mentioned steps S542B, into
When row charging, then 0.15/ ten thousand progress chargings of calling Freight Basis after reducing can be selected.It can promote API algorithm with this
Competition and promotion, reverse energization promoted service quality.
The method of the calling charging for the API that yet another embodiment of the invention provides, receives API Calls request, obtains the API tune
With the initial data carried in request, responds API Calls request call target API and initial data is handled, tied
Fruit data, and it is based on initial data and result data, the calling effect of target API is obtained, based on calling effect to target API's
It calls and carries out charging.Calling charging method compared to API shown in FIG. 1, the present embodiment effect and can also refer to according to calling
It marks data and carries out charging, further can also reduce the calling charging mark of target API when calling effect to be lower than effect threshold value
Standard promotes the competition and promotion of API algorithm to more accurately carry out charging to the calling of API.
Referring to Fig. 9, Fig. 9 shows the module frame chart of the calling message accounting 100 of API provided in an embodiment of the present invention.
It will be illustrated below for block diagram shown in Fig. 9, the calling message accounting 100 of the API includes: receiving module 110, processing
Module 120 obtains module 130 and accounting module 140, in which:
Receiving module 110 obtains the initial data carried in the API Calls request for receiving API Calls request.
Processing module 120 is handled the initial data for responding the API Calls request call target API,
Obtain result data.
Module 130 is obtained, for being based on the initial data and the result data, obtains the calling of the target API
Effect.
Further, the acquisition module 130 further include: processing submodule and comparison submodule, in which:
It handles submodule and obtains reference result number for handling by designated treatment mode the initial data
According to, wherein the designated treatment mode is different from the invocation target API.
It compares submodule and obtains the target for comparing the reference result data and the result data
The calling effect of API.
Accounting module 140 obtains the calling of the target API for being based on the initial data and the result data
Effect.
Further, the accounting module 140 further include: call number acquisition submodule and the first charging submodule,
Wherein:
Call number acquisition submodule, for obtaining the call number of the target API.
First charging submodule, for calling effect and the call number to the calling of the target API based on described
Carry out charging.
Further, the first charging submodule further include: default metering period acquiring unit, call number obtain single
Member and Charging Detail Record unit, in which:
Default metering period acquiring unit, for obtaining the default metering period of the target API.
Call number acquiring unit, for obtaining call number of the target API in the default metering period.
Charging Detail Record unit, for the calling based on the calling effect and the target API in the default metering period
Number carries out charging to expense of the target API in the default metering period.
Further, the accounting module 140 further include: achievement data acquisition submodule and the second charging submodule,
Wherein:
Achievement data acquisition submodule, for obtaining the achievement data of the target API, wherein the achievement data is extremely
Few includes calling delay and bandwidth occupancy.
Second charging submodule, for calling effect and the achievement data to the calling of the target API based on described
Carry out charging.
Further, the accounting module 140 further include: judging submodule, Freight Basis reduce submodule and third
Charging submodule, in which:
Judging submodule, for judging whether the calling effect is lower than effect threshold value.
Freight Basis reduces submodule, for reducing the target when the calling effect is lower than the effect threshold value
The calling Freight Basis of API.
Third charging submodule, the calling of the target API is carried out by the calling Freight Basis after reduction based on
Take.
Further, the calling message accounting 100 of the API further include: sampling device determining module calls effect to obtain
Module and Freight Basis determining module, in which:
Sampling device determining module, for at least partly equipment in multiple equipment to be determined as sampling device.
Effect is called to obtain module, for obtaining the target API in the calling effect of the sampling device.
Freight Basis determining module, for based on the target API the sampling device calling effect, determine described in
The calling Freight Basis of target API.
It is apparent to those skilled in the art that for convenience and simplicity of description, foregoing description device and
The specific work process of module, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In several embodiments provided by the present invention, the mutual coupling of module can be electrical property, mechanical or other
The coupling of form.
It, can also be in addition, each functional module in each embodiment of the present invention can integrate in a processing module
It is that modules physically exist alone, can also be integrated in two or more modules in a module.Above-mentioned integrated mould
Block both can take the form of hardware realization, can also be realized in the form of software function module.
A kind of electronic equipment provided by the invention is illustrated below in conjunction with Figure 10.
Referring to Fig. 10, Figure 10 shows the structural block diagram of a kind of electronic equipment provided in an embodiment of the present invention.The present invention
In electronic equipment 200 may include one or more such as lower component: processor 210, memory 220 and one or more journeys
Sequence, wherein one or more programs can be stored in memory 220 and be configured as being held by one or more processors 210
Row, one or more programs are configured to carry out the method as described in preceding method embodiment.
Wherein, processor 210 may include one or more processing core.Processor 210 utilizes various interfaces and route
The various pieces in entire electronic equipment 200 are connected, by running or executing the instruction being stored in memory 220, program, generation
Code collection or instruction set, and the data being stored in memory 220 are called, execute the various functions and processing of electronic equipment 200
Data.Optionally, processor 210 can be using Digital Signal Processing (Digital Signal Processing, DSP), scene
Programmable gate array (Field-Programmable Gate Array, FPGA), programmable logic array (Programmable
Logic Array, PLA) at least one of example, in hardware realize.Processor 210 can integrating central processor (Central
Processing Unit, CPU), in image processor (Graphics Processing Unit, GPU) and modem etc.
One or more of combinations.Wherein, the main processing operation system of CPU, user interface and application program etc.;GPU is for being responsible for
Show the rendering and drafting of content;Modem is for handling wireless communication.It is understood that above-mentioned modem
It can not be integrated into processor 210, be realized separately through one piece of communication chip.
Memory 220 may include random access memory (Random Access Memory, RAM), also may include read-only
Memory (Read-Only Memory).Memory 220 can be used for store instruction, program, code, code set or instruction set.It deposits
Reservoir 220 may include storing program area and storage data area, wherein the finger that storing program area can store for realizing operating system
Enable, for realizing the instruction (for example split function etc.) of at least one function, for realizing the finger of following each embodiments of the method
Enable etc..It storage data area can be with data that electronic equipment 200 is created in use (such as initial data, result data, tune
With number) etc..
Figure 11 is please referred to, it illustrates a kind of structural frames of computer readable storage medium provided in an embodiment of the present invention
Figure.Program code is stored in the computer-readable storage medium 300, said program code can be called by processor and be executed
State method described in embodiment of the method.
Computer-readable storage medium can be such as flash memory, EEPROM (electrically erasable programmable read-only memory),
The electronic memory of EPROM, hard disk or ROM etc.Optionally, computer-readable storage medium 300 includes non-volatile
Computer-readable medium (non-transitory computer-readable storage medium).It is computer-readable
Storage medium 300 has the memory space for the program code 310 for executing any method and step in the above method.These program generations
Code can read or be written to the production of this one or more computer program from one or more computer program product
In product.Program code 310 can for example be compressed in a suitable form.
In conclusion calling charging method, device, electronic equipment and the storage medium of a kind of API provided by the invention,
API Calls request is received, the initial data carried in API Calls request is obtained, responds API Calls request call target API
Initial data is handled, result data is obtained, is based on initial data and result data, obtains the calling effect of target API,
Charging is carried out based on calling of the calling effect to target API.The present invention is according to initial data and by calling API to original number
The calling effect that target API is obtained according to the result data that processing obtains, based on calling effect to carry out the calling of target API
Take, to accurately carry out charging to the calling of API, promotes the promotion of API service quality.
In the description of this specification, reference term " one embodiment ", " some embodiments ", " example ", " specifically show
The description of example " or " some examples " etc. means specific features, structure, material or spy described in conjunction with this embodiment or example
Point is included at least one embodiment or example of the invention.In the present specification, schematic expression of the above terms are not
It must be directed to identical embodiment or example.Moreover, particular features, structures, materials, or characteristics described can be in office
It can be combined in any suitable manner in one or more embodiment or examples.In addition, without conflicting with each other, the skill of this field
Art personnel can tie the feature of different embodiments or examples described in this specification and different embodiments or examples
It closes and combines.
In addition, term " first ", " second " are used for descriptive purposes only and cannot be understood as indicating or suggesting relative importance
Or implicitly indicate the quantity of indicated technical characteristic.Define " first " as a result, the feature of " second " can be expressed or
Implicitly include at least one this feature.In the description of the present invention, the meaning of " plurality " is at least two, such as two, three
It is a etc., unless otherwise specifically defined.
Any process described otherwise above or method description are construed as in flow chart or herein, and expression includes
It is one or more for realizing specific logical function or process the step of executable instruction code module, segment or portion
Point, and the range of the preferred embodiment of the present invention includes other realization, wherein can not press shown or discussed suitable
Sequence, including according to related function by it is basic simultaneously in the way of or in the opposite order, Lai Zhihang function, this should be of the invention
Embodiment person of ordinary skill in the field understood.
Expression or logic and/or step described otherwise above herein in flow charts, for example, being considered use
In the order list for the executable instruction for realizing logic function, may be embodied in any computer-readable medium, for
Instruction execution system, device or equipment (such as computer based system, including the system of processor or other can be held from instruction
The instruction fetch of row system, device or equipment and the system executed instruction) it uses, or combine these instruction execution systems, device or set
It is standby and use.For the purpose of this specification, " computer-readable medium ", which can be, any may include, stores, communicates, propagates or pass
Defeated program is for instruction execution system, device or equipment or the dress used in conjunction with these instruction execution systems, device or equipment
It sets.The more specific example (non-exhaustive list) of computer-readable medium include the following: there is the electricity of one or more wirings
Interconnecting piece (mobile terminal), portable computer diskette box (magnetic device), random access memory (RAM), read-only memory
(ROM), erasable edit read-only storage (EPROM or flash memory), fiber device and portable optic disk is read-only deposits
Reservoir (CDROM).In addition, computer-readable medium can even is that the paper that can print described program on it or other are suitable
Medium, because can then be edited, be interpreted or when necessary with it for example by carrying out optical scanner to paper or other media
His suitable method is handled electronically to obtain described program, is then stored in computer storage.
Finally, it should be noted that the above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although
Present invention has been described in detail with reference to the aforementioned embodiments, and those skilled in the art are when understanding: it still can be with
It modifies the technical solutions described in the foregoing embodiments or equivalent replacement of some of the technical features;And
These are modified or replaceed, do not drive corresponding technical solution essence be detached from technical solution of various embodiments of the present invention spirit and
Range.
Claims (10)
1. the calling charging method of API a kind of, which is characterized in that the described method includes:
API Calls request is received, the initial data carried in the API Calls request is obtained;
It responds the API Calls request call target API to handle the initial data, obtains result data;
Based on the initial data and the result data, the calling effect of the target API is obtained;
Charging is carried out based on calling of the calling effect to the target API.
2. the method according to claim 1, wherein it is described based on the calling effect to the target API's
It calls and carries out charging, comprising:
Obtain the call number of the target API;
Charging is carried out to the calling of the target API based on the calling effect and the call number.
3. according to the method described in claim 2, it is characterized in that, described be based on the calling effect and the call number pair
The calling of the target API carries out charging, comprising:
Obtain the default metering period of the target API;
Obtain call number of the target API in the default metering period;
Call number based on the calling effect and the target API in the default metering period, to the target API
Expense in the default metering period carries out charging.
4. the method according to claim 1, wherein call the equipment of the target API quantity be it is multiple when,
The method also includes:
At least partly equipment in multiple equipment is determined as sampling device;
The target API is obtained in the calling effect of the sampling device;
Based on the target API in the calling effect of the sampling device, the calling Freight Basis of the target API is determined.
5. the method according to claim 1, wherein it is described be based on the initial data and the result data,
Obtain the calling effect of the target API, comprising:
The initial data is handled by designated treatment mode, obtains reference result data, wherein the designated treatment
Mode is different from the invocation target API;
The reference result data and the result data are compared, the calling effect of the target API is obtained.
6. method according to claim 1-5, which is characterized in that described to be based on the calling effect to the mesh
The calling for marking API carries out charging, comprising:
Obtain the achievement data of the target API, wherein the achievement data, which includes at least, calls delay and bandwidth occupancy;
Charging is carried out to the calling of the target API based on the calling effect and the achievement data.
7. method according to claim 1-5, which is characterized in that described to be based on the calling effect to the mesh
The calling for marking API carries out charging, comprising:
Judge whether the calling effect is lower than effect threshold value;
When the calling effect is lower than the effect threshold value, the calling Freight Basis of the target API is reduced;
Charging is carried out based on calling of the calling Freight Basis after reduction to the target API.
8. the calling message accounting of API a kind of, which is characterized in that described device includes:
Receiving module obtains the initial data carried in the API Calls request for receiving API Calls request;
Processing module handles the initial data for responding the API Calls request call target API, is tied
Fruit data;
Module is obtained, for being based on the initial data and the result data, obtains the calling effect of the target API;
Accounting module, for carrying out charging based on calling of the calling effect to the target API.
9. a kind of electronic equipment characterized by comprising
One or more processors;
Memory;
One or more programs, wherein one or more of programs are stored in the memory and are configured as by described
One or more processors execute, and one or more of programs are configured to carry out as claim 1-7 is described in any item
Method.
10. a kind of computer-readable storage medium, which is characterized in that be stored with journey in the computer-readable storage medium
Sequence code, said program code can be called by processor and execute the method according to claim 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910300884.5A CN110135892A (en) | 2019-04-15 | 2019-04-15 | Calling charging method, device, electronic equipment and the storage medium of API |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910300884.5A CN110135892A (en) | 2019-04-15 | 2019-04-15 | Calling charging method, device, electronic equipment and the storage medium of API |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110135892A true CN110135892A (en) | 2019-08-16 |
Family
ID=67569975
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910300884.5A Pending CN110135892A (en) | 2019-04-15 | 2019-04-15 | Calling charging method, device, electronic equipment and the storage medium of API |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110135892A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP3839846A1 (en) * | 2019-12-20 | 2021-06-23 | Fujitsu Limited | Service cost calculation device, method, and program |
CN113037836A (en) * | 2021-03-05 | 2021-06-25 | 北京金山云网络技术有限公司 | Cloud service trial method, API gateway, electronic equipment and storage medium |
CN113746646A (en) * | 2021-08-30 | 2021-12-03 | 中国银联股份有限公司 | Application program interface API gateway charging method, device, equipment and medium |
CN114679459A (en) * | 2022-05-07 | 2022-06-28 | 阿里巴巴(中国)有限公司 | Cloud function calling method and device |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103399968A (en) * | 2013-07-16 | 2013-11-20 | 中国科学院计算技术研究所 | Microblog information acquisition method and microblog information acquisition system |
CN103513989A (en) * | 2013-09-30 | 2014-01-15 | 广州华多网络科技有限公司 | Method and device for obtaining key data |
-
2019
- 2019-04-15 CN CN201910300884.5A patent/CN110135892A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103399968A (en) * | 2013-07-16 | 2013-11-20 | 中国科学院计算技术研究所 | Microblog information acquisition method and microblog information acquisition system |
CN103513989A (en) * | 2013-09-30 | 2014-01-15 | 广州华多网络科技有限公司 | Method and device for obtaining key data |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
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 |
CN113037836A (en) * | 2021-03-05 | 2021-06-25 | 北京金山云网络技术有限公司 | Cloud service trial method, API gateway, electronic equipment and storage medium |
CN113746646A (en) * | 2021-08-30 | 2021-12-03 | 中国银联股份有限公司 | Application program interface API gateway charging method, device, equipment and medium |
CN114679459A (en) * | 2022-05-07 | 2022-06-28 | 阿里巴巴(中国)有限公司 | Cloud function calling method and device |
CN114679459B (en) * | 2022-05-07 | 2024-03-12 | 阿里巴巴(中国)有限公司 | Cloud function calling method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110135892A (en) | Calling charging method, device, electronic equipment and the storage medium of API | |
CN108776934B (en) | Distributed data calculation method and device, computer equipment and readable storage medium | |
CN107480624B (en) | Permanent resident population's acquisition methods, apparatus and system, computer installation and storage medium | |
CN104103113A (en) | Queuing server and queuing method | |
CN109445884B (en) | Function label display method and terminal equipment | |
CN111985726B (en) | Resource quantity prediction method and device, electronic equipment and storage medium | |
CN110570575A (en) | Online queuing and calling system | |
CN113450002A (en) | Task allocation method and device, electronic equipment and storage medium | |
CN109615172A (en) | A kind of method and terminal handling examination data | |
CN109086289A (en) | A kind of media data processing method, client, medium and equipment | |
CN108428009A (en) | A kind of channel distribution method and device | |
CN110489242A (en) | Distributed data calculation method, device, terminal device and storage medium | |
CN112530074A (en) | Queuing and calling reminding method, device, equipment and storage medium | |
CN113393230A (en) | Dish settlement method, device, equipment, medium and system in restaurant | |
CN107105440A (en) | A kind of information processing method, device and business operation support system | |
CN212659111U (en) | Efficient ordering equipment | |
CN103188629B (en) | Flow bootstrap technique between a kind of networks with different systems and device | |
CN108921385A (en) | Method and system are maintained based on natural person | |
CN114448060A (en) | Charging control method, charging control device, storage medium, and electronic apparatus | |
EP3800605A1 (en) | Methods and systems for predicting wait time of queues at service area | |
CN113706307A (en) | Stock medium and long term trend prediction method, equipment, system and medium | |
CN114581130A (en) | Bank website number assigning method and device based on customer portrait and storage medium | |
CN113382087B (en) | Push time prediction method, push time prediction device, push time prediction equipment, storage medium and program product | |
CN112116483A (en) | Policy data processing method, query method, storage medium and electronic device | |
CN113391923B (en) | System resource data allocation method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190816 |