You want to publish an API that enables fetching NULL data in the published API and querying other data in the meantime.
FineDataLink supports passing a NULL value through a parameter in an API.
This document uses the SORDER table as an example to illustrate how to publish the table data as an API that enables fetching data where the value of SHIPPED_DATE is NULL and querying other data in the meantime.
Click Data Service, choose New > API Service, enter the name of the API service, and click OK, as shown in the following figure.
The following figure shows the setting page.
SELECT * FROM `demotest`.`SORDER` where IF ('$Shipped_Date'='NULL', SHIPPED_DATE IS NULL,SHIPPED_DATE='$Shipped_Date')
The following table describes the setting items.
For details about each setting item, see Overview of API Release.
SQL Statement
Enter the statement. This example uses MySQL syntax. Adjust the statements accordingly if you use other databases.
Pagination Query
Disable Pagination Query. The API to be generated will return data without pagination after being called.
Custom Parameter
Disable Mandatory in Custom Parameter, which means that the parameter value can be empty, and the default value is NULL.
After publishing the API, you can perform data filtering with the parameter set in the SQL statement during data fetching through the API.
1. Select POST as Request Method and set the path to Doc_490. Custom path is supported.
Add an App. If no App has been created, you can skip this step and bind the API to an App in App List after completing the API creation. For details, see Binding an API to an Application. The binding step is mandatory, otherwise the API cannot be called later.
Set Request Body Format to application/json, as shown in the following figure.
2. Click Test Call in the lower right corner to debug the API. The parameter value of area is NULL. Data where the value of Shipped_Date is NULL is returned, as shown in the following figure.
3. Click Save and Activate.
If you do not bind the API to a specified App when publishing the API, you can still manage the published API by binding it to an App in App List to ensure that the API can be called.
For details about using published APIs, see Using APIs Released in Data Service (POST application/json Request).
You can view the data where the parameter value is NULL, as shown in the following figure.
For details about managing published APIs, see Data Service O&M.
滑鼠選中內容,快速回饋問題
滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。
不再提示
10s後關閉
Submitted successfully
Network busy