Populate Push Dataset
This article explains how to use API to insert and clear data from a push dataset.
To Push Data
Use the below steps to push data to the dataset using the Resource portal. In order to push data, you must specify the Push Data Token while creating the dataset. Push Data Token is a valid string with a maximum length of 20 characters. You must add this token in the endpoint URL to insert the data in a push dataset. This will make sure that only authorized users are able to add the data to the push dataset.
Also, the only way to insert data into the push dataset, is through API (JSON). In the below steps, we have used Postman, a great tool for sending API requests, for pushing the data to the dataset.
On the Resource portal, go to Document Types > Dataset.
Select the push dataset in which you want to insert the data.
Click the More button and then select the Push Data Endpoint Information option from the list.
A Push Data Endpoint Information dialog box appears that provides information about the API request to insert data in the dataset such as End Point, Request body, and Information.
Copy the End Point from the Push Data Endpoint Information dialog box into the URL box of the Postman.
Change the method type to 'POST'.
In the Body tab of Postman, set the type to 'raw', and then specify the format as 'JSON'.
Copy the Request body from the Push Data Endpoint Information dialog box into the body area of the Postman.
The columns in the request body represent the names of the fields, while the rows represent the content of the fields. You can set overwrite to 'true' to overwrite the previous content, or 'false' to add the new content to the previous one.
The below example uses the default values.
If you want to add multiple rows, use an array as shown below.
Now, click the Send button. You will see a success message on the successful addition of the data.
Preview the dataset to see the newly added data.
To Clear Data
Based on your business requirement, you can delete the data you no longer require since the data in a push dataset keeps accumulating with time. In order to clear data, you must specify the Push Data Token while creating the dataset. Push Data Token is a valid string with a maximum length of 20 characters. You must add this token in the endpoint URL to clear the data in a push dataset. This will make sure that only authorized users are able to clear the data from the push dataset.
The only way to clear the data in a push dataset, is through API (JSON). In the below steps, we have used Postman, a great tool for sending API requests, for deleting the data from the dataset.
Have a look at the below push dataset. It contains the employee details such as the name, address, phone, and age. Let us suppose, you want to clear the data for those employees with ages greater than 30.
On the Resource portal, go to Document Types > Dataset.
Select the push dataset from which you want to delete the data.
Click the More button and then select the Clear Data Endpoint Information option from the list.
A Clear Data Endpoint Information dialog box appears that provides information about the API request to delete data in the dataset such as End Point, Request body, and Information.
Copy the End Point from the Clear Data Endpoint Information dialog box into the URL box of the Postman.
Change the method type to 'DELETE'.
In the Body tab of Postman, set the type to 'raw', and then specify the format as 'JSON'.
Copy the Request body from the Clear Data Endpoint Information dialog box.
You can modify the copied request body based on your business requirements. Since we want to delete the employee details whose age is greater than 30. The request body will look as follows.
The option supports these three operators - '>', '<', and '='.
Now, click the Send button. You will see a success message on the successful deletion of the data.
Preview the dataset to see the pushed dataset.