The content of the invention
In view of this, the technical problems to be solved by the invention there is provided a kind of interface generation school based on open platform
Method and apparatus is tested, the combination that error checking and interface are generated can be applied in third party developer and start access and access procedure
In, interface generting machanism ensures that third party developer generates correct interface, and error-checking mechanism ensures third party developer in life
Simple and rapid solution is provided during into wrong interface, so that it is guaranteed that the smoothness of third party developer's exploitation, also mitigates
The operating pressures of open platform technologies customer services.
In order to solve the above-mentioned technical problem, calibration equipment is generated the invention discloses a kind of interface based on open platform,
Including:Setup module, configuration module, reminding module, interface generation module and error checking module, wherein, the setup module,
Reference format for pre-setting the element;The configuration module, for the construction rule according to each type of interface
The element needed for each type of interface of generation is obtained respectively;The reminding module, for being carried in application program access interface
Show corresponding with the type of the incoming interface waiting element of input, the input content and the application program phase of received element
Close;The interface generation module, for according to the element and it is corresponding with the type of the interface construct rule generation described in
Interface;The error checking module, for when accessing the interface failure, according to the reference format to involved by the element
And character string verified, analyze the factor that the interface accesses failure according to check results.
Further, the element, including:With the interface related domain name, path and/or interaction parameter.
Further, the error checking module, for the order according to domain name, path, interaction parameter in the element
Using Chain of Responsibility mode, the character string involved by the element is verified according to the reference format.
Further, the error checking module, for after the reason for interface accesses failure is analyzed, with reference to institute
State reference format and provide amendment prompting.
Further, the error checking module, enters according to the reference format to the character string involved by the element
During row verification, for being matched according to the reference format using regular expression to the character string involved by the element.
Further, the error checking module, enters according to the reference format to the character string involved by the element
During row verification, for being judged to carry out the character string involved by the interaction parameter using data interval according to the reference format
Matching verification.
Further, the error checking module, for according to the element and corresponding with the type of the interface
When construction rule generates the interface, the interaction parameter in the element is verified, if the input of the interaction parameter
There is mistake in content, then shows wrong content and provide amendment prompting for changing inputted interaction parameter, if the interaction
The input content of parameter is correct, then notifies that the interface generation module is handled according to the input content of the interaction parameter.
Further, the interface generation module, when being handled according to the input content of the interaction parameter, for root
The digital signature applied to the interface is obtained according to the key information in the interaction parameter.
In order to solve the above-mentioned technical problem, verification side is generated the invention also discloses a kind of interface based on open platform
Method, including:Pre-set the reference format of the element;Generation is obtained according to the construction of each type of interface rule respectively every
Element needed for the interface of type;In application program access interface, prompting input is corresponding with the type of incoming interface waiting first
Element, the input content of the element is related to the application program;It is according to the element and corresponding with the type of the interface
The construction rule generation interface;When accessing the interface failure, according to the reference format to involved by the element
Character string is verified, and the factor that the interface accesses failure is analyzed according to check results.
Further, the element, including:With the interface related domain name, path and/or interaction parameter.
Further, when being verified according to the reference format to the character string involved by the element, according to described
Domain name, path, the order of interaction parameter are completed using Chain of Responsibility mode in element.
Further, after the factor of the interface access failure is analyzed, provide amendment with reference to the reference format and carry
Show.
Further, when accessing the interface success, the implementing result page.
Further, verification is carried out to the character string involved by the element to be accomplished by the following way:According to the mark
Quasiconfiguaration is matched using regular expression to the character string involved by the element.
Further, when accessing the interface failure, data interval judgment mode is used always according to the reference format
Matching verification is carried out to the character string involved by the element.
Further, according to the element and corresponding with the type of the interface rule generation interface is being constructed
When, also the interaction parameter in the element is verified, if mistake occurs in the input content of the interaction parameter, shown
Wrong content simultaneously provides amendment prompting, if the input content of the interaction parameter is correct, the input to the interaction parameter
Content is handled.
Further, the interaction parameter in the element is verified, including:Canonical is used according to the reference format
Expression formula is matched to the character string involved by the interaction parameter, and is sentenced according to the reference format using data interval
The disconnected character string to involved by the interaction parameter carries out matching verification.
Further, the input content of the interaction parameter is handled, including:When the interaction parameter is further wrapped
When including key information, the digital signature applied to the interface is obtained always according to the key information.
Compared with currently existing scheme, the technique effect that the present invention is obtained:
1)The combination of error checking and interface generation can be applied in third party developer and start in access and access procedure,
Interface generting machanism ensures that third party developer generates correct interface, and error-checking mechanism ensures that third party developer is generating
Simple and rapid solution is provided during wrong interface, so that it is guaranteed that the smoothness and high efficiency of third party developer's exploitation.
2)Error checking is used as an easy errored response mechanism so that third party developer timely can obtain in error
To answer, at the same to a certain extent can substitute technology customer service function, and then alleviate the work of open platform technologies customer service
Pressure, can greatly promote the operating efficiency of open platform side, save more manpowers.
3)Interface generting machanism, which only needs to third party developer's offer element, can automatically generate interface, enormously simplify people
The complexity of work operation, so as to effectively reduce the probability for mistake occur.
Embodiment
Describe embodiments of the present invention in detail below in conjunction with schema and embodiment, thereby how the present invention is applied
Technological means can fully understand and implement according to this to solve technical problem and reach the implementation process of technology effect.
The present invention is applied to open platform, as shown in figure 1, being the method flow diagram of the embodiment of the present invention, performs following behaviour
Make:Pre-set the reference format of the element(Step S1);Life is obtained according to the construction of each type of interface rule respectively
Element into needed for each type of interface(Step S2);Prompting input and incoming interface waiting in application program access interface
The corresponding element of type, the input content of the element is related to the application program(Step S3);Further according to the element and
It is corresponding with the type of the interface to construct the rule generation interface(Step S4);When accessing the interface failure, according to
The reference format is verified to the character string involved by the element, and analyzing the interface according to check results accesses mistake
The factor lost(Step S5).
The method of the present invention is illustrated with an embodiment below.As shown in Fig. 2 being the specific reality of the embodiment of the present invention
Flow chart is applied, following operation is performed:
Step SS1, pre-sets the reference format of the element;Taken out respectively according to each type of API construction rule
Element as needed for being born into each type of API;Prompting input and API to be accessed type when application program accesses API
Corresponding element, the input content of the element is related to the application program;Class further according to the element and with the API
Type constructs the rule generation API accordingly;
The element, including:Domain name, path and/or the interaction parameter of the API;The path is general after domain name
So as to constitute the URL of the API(URL).
When generating the API, also the interaction parameter in the element is verified, if the interaction parameter is defeated
Enter content and mistake occur, then show wrong content and amendment prompting is provided, if the input content of the interaction parameter is correct,
Handled according to the input content of the interaction parameter.
Interaction parameter in the element can be used in combination a variety of verification modes to verify, because the interaction parameter of input
It is varied, therefore corresponding verification mode can be used according to different interaction parameters, including:1)Adopted according to the reference format
The character string involved by the interaction parameter is matched with regular expression, for example with what is realized based on regular expression
URL validators detect the validity of the form of the Callback URL, certainly, and the present invention is not limited to time, can also use canonical table
Up to the formula verification amount of money, authority etc.;2)It can also be judged according to the reference format using data interval(Such as judge the total of character string
Whether whether the value in interval interior, character string is in data interval etc. for body length)To the word involved by the interaction parameter
Symbol string carries out matching verification.Certainly, the present invention is not limited to both of the above, can also use other modes.
The operation handled according to the input content of the interaction parameter, including:When the interaction parameter is further wrapped
When including key information, the digital signature applied to the API is obtained always according to the key information;Certainly other can also be included
Operation, the present invention is not limited to this.
Illustrate step SS1 interface generting machanism exemplified by generating the API for being used for supplementing with money below.
The URL of API for supplementing with money is https://openapi.360.cn/page/pay, wherein
Openapi.360.cn is the domain name of the API, and page/pay is the path of the API, it is necessary to the interaction parameter of input
It is as shown in the table:
As shown in figure 3, being the operational flowchart of interface generting machanism in the embodiment of the present invention.
When application program accesses above-mentioned API, the selection access API first points out input API URL(Including
Domain name and path), i.e. https://openapi.360.cn/page/pay, in addition it is also necessary to four interaction parameters inputted in upper table
App_key, user_id, notify_uri, amount and extra interaction parameter app_secret(Key information), the 3rd
Square developer inputs according to the actual conditions of application program(That is step S110);Assuming that the interaction parameter of third party developer's input
Particular content be:
app_key=2d49f00dad3c4c70c71ac8da2fe7228c,
user_id=123456,
notify_uri=http://notify/uri,
amount=100,
App_secret=1b74b02c23942045f6f5778de306b691,
Interaction parameter is verified automatically according to the data form of the interaction parameter(That is step S120)If, the interaction
There is mistake in the input content of parameter, then automatic Display wrong content and provide amendment prompting for third party developer change input
Interaction parameter(That is step S130)If the input content of the interaction parameter is correct, also automatically according to the app_
Secret uses signature calculation method(Such as md5)The digital signature sign applied to the API is calculated, certainly, except signature
Calculate, other processing can also be carried out according to the input content of the interaction parameter(That is step S140).
Finally automatically according to above-mentioned element and corresponding with the type of the API construct the rule generation API(That is step
S150):
https://openapi.360.cn/page/pay?app_key=2d49f00dad3c4c70c71ac8da2fe72
28c&user_id=123456¬ify_uri=http://notify/uri&amount=100&sign=
9ea3fc8f46c6a57df4757215c0b2774e
Step SS2, accesses the API, when accessing the API failures, performs step SS3 or step SS4;Accessing
During the API successes, the corresponding API implementing result page is called.
Step SS3, the interface according to the elementary analysis accesses the factor of failure and provides amendment prompting, and third party opens
Originator regenerates the API after the element according to amendment prompting modification input, returns and performs step SS2;
Order according to domain name in the element, path, interaction parameter is verified using Chain of Responsibility mode;According to described
Interface described in elementary analysis accesses the factor of failure and provides amendment prompting, specifically includes:When accessing the API failures, root
The character string involved by the element is verified according to the reference format, the type and the interface of the API is analyzed
The factor of failure is accessed, and amendment prompting is provided for changing inputted element with reference to the reference format.
The means that implement verified to the character string include in the following manner:1)Used according to the reference format
Regular expression is successively matched to character string involved in domain name and path, the institute provided for same open platform
There is API domain name usually identical, and the path for each API that same open platform is provided is then different;2)Further according to
The data form of the interaction parameter is used in combination a variety of verification modes to verify the wrong content of interaction parameter, because input
Interaction parameter is varied, therefore corresponding verification mode can be used according to different interaction parameters, including:According to the standard
Form is matched using regular expression to the character string involved by the interaction parameter, for example with based on regular expression
The URL validators of realization detect the validity of the form of the Callback URL, certainly, and the present invention is not limited to time, can also be used
The regular expression verification amount of money, authority etc.;It can also be judged according to the reference format using data interval(Such as judge character string
Overall length whether in interval, whether the value of character string in data interval etc.)To involved by the interaction parameter
Character string carry out matching verification.Certainly, the present invention is not limited to both of the above, can also use other modes.
Step SS3 error-checking mechanism is illustrated with an application example below.
The URL of API for supplementing with money is https://openapi.360.cn/page/pay, wherein
Openapi.360.cn is the domain name of the API, and page/pay is the path of the API, and interaction parameter is as shown in the table:
As shown in figure 4, being the operational flowchart of error-checking mechanism in the embodiment of the present invention.Pre-set the element
Reference format(That is step S310), it is necessary to explanation, the domain name of open platform is typically all unique, so under open platform
Each API domain name is exactly openapi.360.cn, and each API path is then different but observes standard form;For this example
In for the API that supplements with money, it states the reference format in domain name and path i.e. such as https://openapi.360.cn/page/
Pay, including character therein, symbol and present position;For in this example for the API supplemented with money, the form of its interaction parameter
I.e. as shown in data form in upper table.
When accessing the API failures, according to above-mentioned default reference format using regular expression in the element
Domain name involved by character string verified(That is step S320), Direct Analysis, which makes mistake, if wrong content and provides
The domain name of input is changed in amendment prompting for third party developer(That is step S330);
Regular expression is further used in the element according to above-mentioned default reference format if without mistake
Path involved by character string verified(That is step S340), Direct Analysis, which makes mistake, if wrong content and provides
The path of input is changed in amendment prompting for third party developer(That is step S350);
If being that can to analyze the function of the API be to supplement with money according to domain name and path, and then confirm without mistake
The API, interaction parameter is verified further according to the data form of interaction parameter corresponding with the API(That is step S360), such as
It is really wrong, Direct Analysis make mistake content and with reference to the reference format provide amendment prompting for third party developer modification
The interaction parameter of input(That is step S370);
If without mistake, it indicates that verification does not find mistake(That is step S380)If access interface is still sent out again
Raw mistake, then explanation is the mistake that automatic error handling mechanism can not be tackled, and at this moment can further perform step SS4 and seek depth
Degree processing.
Step SS4, third party developer checks after error code or error description that the related operation personnel of contact or technology are objective
Take and seeked advice from, then modified according to resulting consulting result and regenerate API, returned and perform step SS2.
Above-mentioned steps SS4 is manual errors treatment mechanism of the prior art, and above-mentioned steps SS3 is automatic intelligence of the invention
Energy error handling mechanism, it can be seen that step SS3 provides useful supplement for prior art in step SS4, and of the invention is automatic
Error handling mechanism can tackle and provide preferable solution completely for conventional error, and for automatic error handler
The mistake that can not be tackled is made, step SS4 can be further performed and seek advanced treating, it is clear that automatic error handling mechanism is significantly
Improve the development efficiency of third party developer in ground.
The equipment of the present invention is illustrated with an embodiment below, the equipment is corresponding with above method flow, it is not enough
Part refers to above method part.As shown in figure 5, the first structure figure of the equipment for the embodiment of the present invention.It is described to be used to open
The interface generation calibration equipment of platform is laid flat, including:Setup module 10, configuration module 20, reminding module 30, interface generation module 40
With error checking module 50, wherein,
The setup module 10, the reference format for pre-setting the element;The element, including:Connect with described
Mouth related domain name, path and/or interaction parameter;
The configuration module 20, obtains generation each type of respectively for the construction rule according to each type of interface
Element needed for interface;
The reminding module 30, is connected with configuration module 20, for pointing out input in application program access interface with treating
The corresponding element of type of access interface, the input content of the received element is related to the application program;
The interface generation module 40, is connected with reminding module 30, for the class according to the element and with the interface
Type constructs the rule generation interface accordingly;
The error checking module 50, is connected with setup module 10, for when accessing the interface failure, according to described
Reference format is verified to the character string involved by the element, and analyzing the interface according to check results accesses failure
Factor.Especially, the error checking module 50 uses responsibility according to the order of domain name in the element, path, interaction parameter
Chain mode, is verified according to the reference format to the character string involved by the element;And in verification, further root
The character string involved by the element is matched using regular expression according to the reference format;Can also be according to the mark
Quasiconfiguaration is judged using data interval(Such as judge character string overall length whether in interval, whether the value of character string locate
In data interval etc.)Matching verification is carried out to the character string involved by the element.Certainly, the present invention is not limited to the above two
Person, can also use other modes.
Error checking module described in this example 50 can be connected with the reminding module 30, directly by the reminding module 30
Place obtains the input content of the element, when accessing the interface failure according to the reference format to involved by the element
Character string verified;Certainly, the error checking module 50 can not also be connected with the reminding module 30, access institute
The input content that analysis obtains the element is carried out to the interface generated when stating interface failure, according to the reference format to institute
The character string involved by element is stated to be verified.
The equipment of the present invention is illustrated with an embodiment again below.As shown in fig. 6, being the equipment of the embodiment of the present invention
The second structure chart, for open platform interface generate calibration equipment, including:Setup module 11, configuration module 21, prompting mould
Block 31, interface generation module 41 and error checking module 51.
Setup module 11, configuration module 21, the function of interface generation module 41 respectively with setup module 10, configuration module
20th, interface generation module 40 is identical, repeats no more.
Reminding module 31 and error checking module 51 are except the work(with such as preceding reminding module 30 and error checking module 50
Can and it perform outside corresponding operating, also with following functions:
The error checking module 51, is further used for after the reason for interface accesses failure is analyzed, with reference to institute
State reference format and provide amendment prompting, and the amendment prompting is sent to the reminding module 31;
The reminding module 31, is further used for the amendment prompting being presented to user.
The equipment of the present invention is illustrated with an embodiment again below.As shown in fig. 7, being the equipment of the embodiment of the present invention
The 3rd structure chart, for open platform interface generate calibration equipment, including:Setup module 12, configuration module 22, prompting mould
Block 32, interface generation module 42 and error checking module 52.
Setup module 12, configuration module 22, the function of reminding module 32 are as described in above two apparatus embodiments, i.e., with setting
Put module 10 and 11, configuration module 20 and 21, the function phase of reminding module 30 and 31 same, repeat no more.
Interface generation module 42 and error checking module 52 are except with such as above two apparatus embodiments(I.e. interface is generated
Module 40 and 41, error checking module 50 and 51)Described function is simultaneously performed outside corresponding operating, also with following functions:
The interface generation module 42, when generating the interface, notifies the error checking module 52;It is additionally operable to
The notice of error checking module 52 is received, when being handled according to the input content of the interaction parameter, for being handed over according to described
Key information in mutual parameter obtains the digital signature applied to the interface;
The error checking module 52, when generating the interface, for carrying out school to the interaction parameter in the element
Test, if mistake occurs in the input content of the interaction parameter, show wrong content and amendment is provided and point out to supply modification institute defeated
The interaction parameter entered, if the input content of the interaction parameter is correct, notifies the interface generation module 42 according to described
The input content of interaction parameter is handled.
It should be noted that in the case where not conflicting, the embodiment in the present invention and the feature in embodiment can phases
Mutually it is combined.
Certainly, the present invention can also have other various embodiments, ripe in the case of without departing substantially from spirit of the invention and its essence
Various corresponding changes and deformation, but these corresponding changes and deformation can be made according to the present invention by knowing those skilled in the art
The protection domain of appended claims of the invention should all be belonged to.
One of ordinary skill in the art will appreciate that all or part of step in the above method can be instructed by program,
Related hardware is completed, and described program can be stored in computer-readable recording medium, such as read-only storage, disk or CD
Deng.Alternatively, all or part of step of above-described embodiment can also use one or more integrated circuits to realize.Accordingly
Each module/unit in ground, above-described embodiment can be realized in the form of hardware, it would however also be possible to employ the shape of software function module
Formula is realized.The present invention is not restricted to the combination of the hardware and software of any particular form.