CN112818016A - API-based real-time and off-line data query method and system - Google Patents

API-based real-time and off-line data query method and system Download PDF

Info

Publication number
CN112818016A
CN112818016A CN202110083948.8A CN202110083948A CN112818016A CN 112818016 A CN112818016 A CN 112818016A CN 202110083948 A CN202110083948 A CN 202110083948A CN 112818016 A CN112818016 A CN 112818016A
Authority
CN
China
Prior art keywords
user
data query
query
data
real
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
Application number
CN202110083948.8A
Other languages
Chinese (zh)
Inventor
李保平
杨建荣
欧再辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Huitong Guoxin Technology Co Ltd
Original Assignee
Guangzhou Huitong Guoxin Technology Co Ltd
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 Guangzhou Huitong Guoxin Technology Co Ltd filed Critical Guangzhou Huitong Guoxin Technology Co Ltd
Priority to CN202110083948.8A priority Critical patent/CN112818016A/en
Publication of CN112818016A publication Critical patent/CN112818016A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2457Query processing with adaptation to user needs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/31User authentication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/604Tools and structures for managing or administering access control systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Linguistics (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Automation & Control Theory (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention relates to a real-time and off-line data query method based on an API (application program interface), which comprises the following steps: acquiring a data query request type of a user, wherein the data query request type comprises a real-time data query method and an offline data query method; performing a corresponding query process according to the data query request type of the user, authenticating the identity information of the user when the data query request type of the user is a real-time data query method, acquiring and executing a query statement of the user for the user with successful authentication, and returning a corresponding data set; for the user with the authentication failure, the current process is ended; when the data query request type of the user is an off-line data query method, the identity information of the user is authenticated, a download file URL is generated for the user successfully authenticated, an asynchronous task is executed, a query statement of the user is obtained and executed to obtain a query result file, the query result file is submitted to the download URL of the configuration file in the form of a temporary file, and a download address is returned.

Description

API-based real-time and off-line data query method and system
Technical Field
The invention relates to the field of data management, in particular to a real-time and off-line data query method and system based on an API (application program interface).
Background
Different IT software is used for business management in various enterprises, such as ERP, CRM, purchasing systems and the like, huge data streams often exist in the systems, the corresponding systems bring great convenience to the enterprises and also bring much trouble, and one of the most troublesome problems of the enterprises is the problem of information exchange among different systems and platforms.
If the data transmission between different systems is realized by manpower, the time cost required is high; the development effort required is also high if new systems or information exchange components are developed for different workflow orientations, since this approach has the disadvantage of low scalability and requires a redevelopment of each new traffic flow.
Disclosure of Invention
The invention aims to solve at least one of the defects of the prior art and provides a real-time and offline data query method and system based on an API.
In order to achieve the purpose, the invention adopts the following technical scheme:
specifically, a real-time and off-line data query method based on an API is provided, which comprises the following steps:
acquiring a data query request type of a user, wherein the data query request type comprises a real-time data query method and an offline data query method;
the corresponding query process is carried out according to the data query request type of the user,
when the data query request type of the user is the real-time data query method,
the identity information of the user is authenticated,
for the user successfully authenticated, acquiring and executing a query statement of the user, and returning a corresponding data set;
for the user with the authentication failure, the current process is ended;
when the data query request type of the user is the offline data query method,
the identity information of the user is authenticated,
and for the user successfully authenticated, generating a download file URL, executing an asynchronous task, acquiring and executing a query statement of the user to obtain a query result file, submitting the query result file to the download URL of the configuration file in a temporary file form, and returning to a download address.
Further, the above-mentioned process of authenticating the identity information of the user specifically includes the following steps,
connecting an authentication server;
correspondingly entering a first mode or a second mode according to a request of a user;
completing authentication according to the entered mode;
the first mode is specifically to verify the account password of the user by verifying the account password of the user, and the second mode is specifically to verify the IdP information firstly, verify the account password of the user if the IdP information passes SP authentication, judge that the current API has security risk if the IdP information does not pass SP authentication, report an error and terminate the current process.
Furthermore, when the corresponding result is obtained by executing the query statement of the user, the result is generated and packaged.
Further, the method also comprises the steps of backing up the data of the corresponding database to be inquired before executing the inquiry operation of the user each time, and replacing the corresponding data in the database with the backed-up data after the user finishes the inquiry operation.
Further, the method also comprises the step of displaying operation information failed in verification in the operation and the identity information of the user in a log file on the current day together when each operation is executed.
The invention also provides a real-time and off-line data query method system based on the API, which comprises,
the query request acquisition module is used for acquiring data query request types of a user, wherein the data query request types comprise a real-time data query method and an offline data query method;
a query flow operation module for performing corresponding query flow according to the data query request type of the user,
when the data query request type of the user is the real-time data query method,
the identity information of the user is authenticated,
for the user successfully authenticated, acquiring and executing a query statement of the user, and returning a corresponding data set;
for the user with the authentication failure, the current process is ended;
when the data query request type of the user is the offline data query method,
the identity information of the user is authenticated,
and for the user successfully authenticated, generating a download file URL, executing an asynchronous task, acquiring and executing a query statement of the user to obtain a query result file, submitting the query result file to the download URL of the configuration file in a temporary file form, and returning to a download address.
The system further comprises a first server, which is used for backing up the data of the queried corresponding database before executing the query operation of the user each time, and replacing the backed-up data with the corresponding data in the database after the query operation of the user is completed.
The invention also proposes a computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 5.
The invention has the beneficial effects that:
the invention can call the data by the API and authenticate the identity of the user before calling, can ensure the safety of the data, and simultaneously provides an off-line and on-line data query mode, thereby saving a large amount of query time and research and development cost.
Drawings
In order to more clearly illustrate the technical solutions in the examples of the present invention, the drawings used in the description of the examples will be briefly introduced below, it is obvious that the drawings in the following description are only some examples of the present invention, and that other drawings can be obtained by those skilled in the art without inventive effort, wherein:
FIG. 1 is a flow chart of the API-based real-time, offline data query method of the present invention;
FIG. 2 is a schematic diagram illustrating the operation of the API-based real-time and offline data query method according to the present invention;
fig. 3 is a schematic diagram illustrating a user authentication method according to the present invention.
Detailed Description
The conception, the specific structure and the technical effects of the present invention will be clearly and completely described in conjunction with the embodiments and the accompanying drawings to fully understand the objects, the schemes and the effects of the present invention. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The same reference numbers will be used throughout the drawings to refer to the same or like parts.
Referring to fig. 1, fig. 2 and fig. 3, in embodiment 1, the present invention provides an API-based real-time and offline data query method, including the following steps:
step 110, obtaining a data query request type of a user, wherein the data query request type comprises a real-time data query method and an offline data query method;
step 120, performing a corresponding query process according to the data query request type of the user,
when the data query request type of the user is the real-time data query method,
the identity information of the user is authenticated,
for the user successfully authenticated, acquiring and executing a query statement of the user, and returning a corresponding data set;
for the user with the authentication failure, the current process is ended;
when the data query request type of the user is the offline data query method,
the identity information of the user is authenticated,
and for the user successfully authenticated, generating a download file URL, executing an asynchronous task, acquiring and executing a query statement of the user to obtain a query result file, submitting the query result file to the download URL of the configuration file in a temporary file form, and returning to a download address.
In this embodiment 1, data can be called through the formation of the API, and the identity of the user is authenticated before the calling, so that the security of the data can be ensured, and meanwhile, an offline and online data query mode is provided, which not only saves a large amount of query time, but also saves research and development costs.
As a preferred embodiment of the present invention, the above-mentioned process of authenticating the identity information of the user specifically includes the following steps,
connecting an authentication server;
correspondingly entering a first mode or a second mode according to a request of a user;
completing authentication according to the entered mode;
the first mode is specifically to verify the account password of the user by verifying the account password of the user, and the second mode is specifically to verify the IdP information firstly, verify the account password of the user if the IdP information passes SP authentication, judge that the current API has security risk if the IdP information does not pass SP authentication, report an error and terminate the current process.
Referring to fig. 3, a client first calls an OnConnect () function to read related information of a server, then calls a Connect () function to create a socket, and establishes a connection with the server; the OnSocket () function is responsible for handling events that occur in Socket calls. After the client establishes connection with the application server, a service request can be sent to the application server, and the Start () function is called to represent the Start of the protocol. The user selects a security mode, if the security mode 1 is selected, the LoginDlg () function is directly called to require the user to input a user name and a password, if the security mode 2 is selected, the IdP information is submitted first, the SP authentication result is waited, if the SP is safe, the LoginDlg () function is called to require the user to input the user name and the password, otherwise, the session is terminated, and the socket is closed. And the application server starts to execute the authentication protocol after receiving the user name and the password.
As a preferred embodiment of the invention, when the query statement of the user is executed, the corresponding result is obtained, and meanwhile, the result is generated and packaged.
In the preferred embodiment, the security of the data can be secured to some extent by being in the form of a package.
As a preferred embodiment of the present invention, the method further includes, before executing the user query operation each time, backing up data of the queried corresponding database, and after the user completes the query operation, replacing the backed-up data with the corresponding data in the database.
In the preferred embodiment, when the user operates, the data is backed up first, so that the behavior that the interface trojan steals and tampers the user information is prevented, and the safety of the data is ensured.
As a preferred embodiment of the present invention, the method further includes displaying operation information that fails to be verified in the second operation and the identity information of the user in a log file of the current day when the second operation is performed.
The invention also provides a real-time and off-line data query method system based on the API, which comprises,
the query request acquisition module is used for acquiring data query request types of a user, wherein the data query request types comprise a real-time data query method and an offline data query method;
a query flow operation module for performing corresponding query flow according to the data query request type of the user,
when the data query request type of the user is the real-time data query method,
the identity information of the user is authenticated,
for the user successfully authenticated, acquiring and executing a query statement of the user, and returning a corresponding data set;
for the user with the authentication failure, the current process is ended;
when the data query request type of the user is the offline data query method,
the identity information of the user is authenticated,
and for the user successfully authenticated, generating a download file URL, executing an asynchronous task, acquiring and executing a query statement of the user to obtain a query result file, submitting the query result file to the download URL of the configuration file in a temporary file form, and returning to a download address.
As a preferred embodiment of the present invention, the system further includes a first server, configured to backup data of a database corresponding to a query before performing a query operation of a user each time, and replace the backed-up data with the corresponding data in the database after the query operation is completed by the user.
The invention also proposes a computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 5.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium and can implement the steps of the above-described method embodiments when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain other components which may be suitably increased or decreased as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media which may not include electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
While the present invention has been described in considerable detail and with particular reference to a few illustrative embodiments thereof, it is not intended to be limited to any such details or embodiments or any particular embodiments, but it is to be construed as effectively covering the intended scope of the invention by providing a broad, potential interpretation of such claims in view of the prior art with reference to the appended claims. Furthermore, the foregoing describes the invention in terms of embodiments foreseen by the inventor for which an enabling description was available, notwithstanding that insubstantial modifications of the invention, not presently foreseen, may nonetheless represent equivalent modifications thereto.
The above description is only a preferred embodiment of the present invention, and the present invention is not limited to the above embodiment, and the present invention shall fall within the protection scope of the present invention as long as the technical effects of the present invention are achieved by the same means. The invention is capable of other modifications and variations in its technical solution and/or its implementation, within the scope of protection of the invention.

Claims (8)

1. The real-time and off-line data query method based on the API is characterized by comprising the following steps:
acquiring a data query request type of a user, wherein the data query request type comprises a real-time data query method and an offline data query method;
the corresponding query process is carried out according to the data query request type of the user,
when the data query request type of the user is the real-time data query method,
the identity information of the user is authenticated,
for the user successfully authenticated, acquiring and executing a query statement of the user, and returning a corresponding data set;
for the user with the authentication failure, the current process is ended;
when the data query request type of the user is the offline data query method,
the identity information of the user is authenticated,
and for the user successfully authenticated, generating a download file URL, executing an asynchronous task, acquiring and executing a query statement of the user to obtain a query result file, submitting the query result file to the download URL of the configuration file in a temporary file form, and returning to a download address.
2. The API-based real-time offline data query method of claim 1, wherein the process of authenticating the identity information of the user specifically comprises the following,
connecting an authentication server;
correspondingly entering a first mode or a second mode according to a request of a user;
completing authentication according to the entered mode;
the first mode is specifically to verify the account password of the user by verifying the account password of the user, and the second mode is specifically to verify the IdP information firstly, verify the account password of the user if the IdP information passes SP authentication, judge that the current API has security risk if the IdP information does not pass SP authentication, report an error and terminate the current process.
3. The API-based real-time offline data query method of claim 1, wherein the query statement of the user is executed to obtain the corresponding result, and the result is encapsulated.
4. The API-based real-time offline data querying method of claim 1, further comprising, before each user querying operation, backing up data of the queried corresponding database, and after the user completes the querying operation, replacing the backed-up data with the corresponding data in the database.
5. The API-based real-time and offline data query method according to claim 1, further comprising displaying operation information failed in the verification in the operation and identity information of the user in a log file of the day together when each operation is completed.
6. The real-time and off-line data query method system based on the API is characterized by comprising,
the query request acquisition module is used for acquiring data query request types of a user, wherein the data query request types comprise a real-time data query method and an offline data query method;
a query flow operation module for performing corresponding query flow according to the data query request type of the user,
when the data query request type of the user is the real-time data query method,
the identity information of the user is authenticated,
for the user successfully authenticated, acquiring and executing a query statement of the user, and returning a corresponding data set;
for the user with the authentication failure, the current process is ended;
when the data query request type of the user is the offline data query method,
the identity information of the user is authenticated,
and for the user successfully authenticated, generating a download file URL, executing an asynchronous task, acquiring and executing a query statement of the user to obtain a query result file, submitting the query result file to the download URL of the configuration file in a temporary file form, and returning to a download address.
7. The API-based real-time offline data query method system according to claim 6, further comprising a first server for backing up data of the queried corresponding database before each execution of the user query operation, and replacing the backed-up data with the corresponding data in the database after the user completes the query operation.
8. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 5.
CN202110083948.8A 2021-01-21 2021-01-21 API-based real-time and off-line data query method and system Pending CN112818016A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110083948.8A CN112818016A (en) 2021-01-21 2021-01-21 API-based real-time and off-line data query method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110083948.8A CN112818016A (en) 2021-01-21 2021-01-21 API-based real-time and off-line data query method and system

Publications (1)

Publication Number Publication Date
CN112818016A true CN112818016A (en) 2021-05-18

Family

ID=75858638

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110083948.8A Pending CN112818016A (en) 2021-01-21 2021-01-21 API-based real-time and off-line data query method and system

Country Status (1)

Country Link
CN (1) CN112818016A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115794922A (en) * 2022-11-29 2023-03-14 广发银行股份有限公司 External data query method, device, equipment and storage medium
WO2023197904A1 (en) * 2022-04-13 2023-10-19 北京字节跳动网络技术有限公司 Data processing method and apparatus, computer device and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103581230A (en) * 2012-07-26 2014-02-12 深圳市腾讯计算机系统有限公司 File transmission system and method, receiving end and sending end
CN108572968A (en) * 2017-03-09 2018-09-25 腾讯科技(深圳)有限公司 A kind of data query method, apparatus, server and system
CN110555068A (en) * 2018-05-14 2019-12-10 北京京东尚科信息技术有限公司 Data export method and device
CN111414407A (en) * 2020-02-13 2020-07-14 中国平安人寿保险股份有限公司 Data query method and device of database, computer equipment and storage medium
CN111756752A (en) * 2020-06-24 2020-10-09 北京金山云网络技术有限公司 Method and device for controlling access authority of database and electronic equipment
CN112182043A (en) * 2020-10-27 2021-01-05 网易(杭州)网络有限公司 Log data query method, device, equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103581230A (en) * 2012-07-26 2014-02-12 深圳市腾讯计算机系统有限公司 File transmission system and method, receiving end and sending end
CN108572968A (en) * 2017-03-09 2018-09-25 腾讯科技(深圳)有限公司 A kind of data query method, apparatus, server and system
CN110555068A (en) * 2018-05-14 2019-12-10 北京京东尚科信息技术有限公司 Data export method and device
CN111414407A (en) * 2020-02-13 2020-07-14 中国平安人寿保险股份有限公司 Data query method and device of database, computer equipment and storage medium
CN111756752A (en) * 2020-06-24 2020-10-09 北京金山云网络技术有限公司 Method and device for controlling access authority of database and electronic equipment
CN112182043A (en) * 2020-10-27 2021-01-05 网易(杭州)网络有限公司 Log data query method, device, equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
郭玲;: "一种企业应用中的单点登录系统的设计" *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023197904A1 (en) * 2022-04-13 2023-10-19 北京字节跳动网络技术有限公司 Data processing method and apparatus, computer device and storage medium
CN115794922A (en) * 2022-11-29 2023-03-14 广发银行股份有限公司 External data query method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN110647580B (en) Distributed container cluster mirror image management main node, slave node, system and method
CN111030812A (en) Token verification method, device, storage medium and server
CN106656927B (en) Method and device for adding Linux account into AD domain
CN112818016A (en) API-based real-time and off-line data query method and system
CN110795174B (en) Application program interface calling method, device, equipment and readable storage medium
CN116204438A (en) Test case generation method, automatic test method and related device
CN111666539A (en) Real estate resource management method, device, server and storage medium
CN108650123B (en) Fault information recording method, device, equipment and storage medium
CN113407458B (en) Interface testing method and device, electronic equipment and computer readable medium
CN107154982B (en) Method and system for auditing log records
CN111371811A (en) Resource calling method, resource calling device, client and service server
CN116383799A (en) Business processing method and device based on applet and electronic equipment
CN107172082B (en) File sharing method and system
CN114070856B (en) Data processing method, device, system, operation and maintenance auditing equipment and storage medium
CN114006939A (en) Message pushing method and device
CN113535427A (en) Method, device, system, terminal and storage medium for processing request message
CN112583890A (en) Message pushing method and device based on enterprise office system and computer equipment
CN111225075A (en) Configuration method and device for Internet of things directional access service
CN114070824B (en) Registration method of Internet of things equipment, registration cloud server and medium
CN114125844B (en) Method and device for generating and downloading digital certificate
CN111754324B (en) Cloud ERP bank-enterprise docking processing method, system and processing ends
CN116055106A (en) Method and system for unified management of login rights
CN115311076A (en) Method and system for returning housing loan in advance based on block chain technology and 5G message
CN117854249A (en) Multi-application real-time to-do reminding system and method
CN115776400A (en) Identity authentication method, device, system and equipment across multiple identity authentication centers

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

Application publication date: 20210518

RJ01 Rejection of invention patent application after publication