Control - API Query
Function
When creating a record or editing a record, you can use this control to call an external API interface to fetch data and fill the fetched data directly into the fields or sub-forms of the current record. In addition to fetching data, pushing data outward is also supported.
Scenario
When adding customer information, search relevant industrial and commercial information from TianYanCha according to the name of the customer company and fill in the relevant fields.
According to the logistics number, after getting the logistics information, it is automatically filled into the logistics information sub-table.
The data source of drop-down list is from external system.
Configuration
Get single row of data
Scenario: After getting the place of belonging according to the phone number, write the data to the corresponding province and city fields.
1. Add the API Query control
2. Select the API
Only the authorized API can be selected.
3. Configure parameters
The system will automatically display the required parameters according to the API configuration. Therefore, the parameters here are not fixed and may be different for different APIs. Parameters with red stars in their names are required, and those without red stars can be filled in optionally.
4. Select the display mode
There are three types, button, drop-down box, and search drop-down box. The differences are as follows.
Button: click the button to request and get the return parameters.
Drop-down box: To request when the drop-down box is activated, and return a list of multiple data as a drop-down menu options to select.
Search drop-down box: To request when the drop-down box is activated, and return a list of multiple data as a drop-down menu options to select.
The drop-down box and search drop-down box's are only suitable for scenarios with multiple data returned. The API for querying which place the phone number belongs to does not return an array of objects, so only the button mode can be selected here. For the other two ways, please refer to the configuration of multi-line data.
5. Write the returned data to the form field
After configuring the API, parameters and types, you can write the returned data to the corresponding fields.
Effect:
Get multiple rows of data
Scenario: After entering the company name, go to the SkyEye API to search for related companies, which may search for multiple companies (multi-line data), and fill in other business information into the corresponding fields.
1. Add the API Query control
2. Select the API
Only the authorized APIs can be selected.
After selecting the API, you also need to configure the incoming parameters. Parameters with red stars in their names are required.
3. Configure parameters
The system will automatically display the required parameters according to the API configuration. Therefore, the parameters here are not fixed and may be different for different APIs.
4. Select the display mode
There are three types, button, drop-down box, and search drop-down box.
In case of button mode, other fields must be selected for the query keyword, and multiple data obtained must be written to the sub-form.
If it is drop-down box and search drop-down box mode, you can enter the search keyword in this field and the search result will be displayed in the drop-down option. When you select one, it is actually equivalent to an exact search. The query result becomes a line of data, and the relevant data is written directly to this record in the general field.
5. Button mode
As it is multiple data, they must be written to the sub-form. You need to select a one-to-one mapping field.
6. Drop-down box mode/Search drop-down box mode
Drop-down box mode requires a field of the returned data to be displayed as an option for the user, so you need to configure the drop-down box options.
The effect of the API return parameters and field configuration parameters is shown below.
More features for the search drop-down box
Please refer to the dropdown box mode for the field mapping and effect of the search dropdown box, but there are more optional features in this mode.
Search mode
Button Search: Enter a keyword and click the button to search and display the options
Real-time Search Automatically search and display options after entering a keyword. This mode may require more API fees.
Minimum number of words
The request will be initiated only when the minimum number of words is met. This configuration can be set when the search parameters of the API have a word limit.
Make a request before searching
If checked, a request is made first when the search dropdown box is activated, at which point the search parameters passed to the interface are empty and the results are returned as preset options. This can be checked when the search parameters of the API can be empty.
Input parameters
The search dropdown box can pass the entered searching content directly to the API as a parameter. In the other two modes you must select other field values.
Rules for field mapping
Have questions about this article? Send us feedback