Four ways to obtain third-party data

Table of contents

call api

remote table

data source

are p

How to judge which method to obtain data?


call api

advantage:

  1. The interface document specification is reflected in the strict description of the request method, the passed parameters and the parameter types
  2. Reduce developer logic processing. The api encapsulates the logic of the function inside the interface, and does not require developers to write the logic by themselves
  3. The interface returns rich information

shortcoming:

1. A business may call multiple interfaces. Such as business: judge whether the user creates a task in compliance with the specification:

Interface 1. Obtain the members under the specified project,

Interface 2. Obtain and create tasks according to members,

Interface 3. Obtain task specific information according to the task id.

Judging whether the task meets the specification

2. Excessive acquisition of data increases the corresponding time. Most of the information returned by the interface is unnecessary. For example, only the personnel under the project are obtained, and the remaining data is not needed, which increases the response time of the interface.

3. The data structure is not clear. You need to use postman or idea to call api and escape or parse before you know the returned data format


remote table

advantage:

  1. You can clearly see the data in the database locally, and the ZenTao data will be updated to the local
  2. flexible. The connection query between tables can be customized according to the requirements

shortcoming:

  1. Occupies server memory resources
  2. Does not support transactions (current business requirements only involve query operations on data tables, not transactions)
  3. Data can only be read locally, but cannot be modified (current business requirements do not involve modification)
  4. You need to be familiar with the table structure, which takes time


data source

advantage:

Flexible configuration. It is convenient to configure the address, user name, password, and library name of the data source in the configuration file, and the database connection information can be modified flexibly

shortcoming:

  1. Data can only be read locally, but cannot be modified (current business requirements do not involve modification)
  2. You need to be familiar with the table structure, which takes time


are p

Simulate user's artificial behavior

shortcoming:

If the website has crawler restrictions, information cannot be obtained


How to judge which method to obtain data?

  1. Is the database on our side and is it possible to connect directly to the database? -Remote tables, data sources
  2. Do you have permission to call the other party's API? - call api
  3. Simulate user's artificial behavior - crawler

If you want to exchange content, please leave a message in the comment area . If this document is liked by you, please leave your likes and collection footprints to support the blogger~

Guess you like

Origin blog.csdn.net/weixin_43319713/article/details/128427072