Zoomdata Version

Using Upload API

You can use the Zoomdata Upload API connector to dynamically upload and stream your data in real-time. Setting up and configuring an Upload API connector has two parts:

The table below lists information on the features Upload API.

Supports Distinct Count? Yes
Supports Live Mode/ Playback? Yes
Supports Group-by Time? Yes
Supports Multi Group-by Charts? Yes
Supports Histogram? No
Supports Box Plot? No
Custom SQL Capable? No
Supports Last Value? No
Supports Partition? No

Setting up your upload api connector

  1. Log into Zoomdata.
  2. Select Sources.
  3. Select Upload API.
  4. Specify the name of your source and add a description (if desired).
  5. Select Next.
  6. On the Sampling page, enter your sample data. The supported formats are CSV, JSON, or XML. You can also upload sample data from a file.
  7. Select Preview to view your data.
  8. Select Next.
  9. On the Fields page, you can edit the data show for the source. For more information and steps, see Connecting to Data.
  10. Select Next.
  11. On the Refresh page, you can set the refresh rates or your data. If you want to schedule a refresh of all your data, you can do so by selecting Schedule and then selecting an option. If you only want certain fields within your data to be refreshed, select Configuration.
  12. You can use cURL calls to clear previously stored data, add additional data to the source, or delete the source. The cURL calls can be found on the API Endpoints page.
  13. Select Next.
  14. On the Charts page, you can:
    • Edit Global Default Settings.
    • Select the Standard and, if available, Custom chart styles to be used with the data source.
    • Set default parameters (group, sub-group, colors, sorting, and so on) for each chart style.

Select Finish to save your changes. Once your data connection has been established, it is listed under My Data Sources.

Working with the upload api curl calls

To clear previously stored data, add additional data to the source, or delete the source, perform the following steps:

  1. On the API Endpoint page, copy the default cURL by clicking Copy to Clipboard. Paste the cURL to any text editor and change the default username and password to the actual Zoomdata credentials:
curl -v --user username : password 'https://example.com/zoomdata/service/upload?source=SourceName&accountId=xxxx' -X PUT -H "Content-Type: application/json" -d '{"product":"value0","price":100.5,"quantity":1}' --insecure
  1. Paste the default values to the JSON part:
curl -v --user username:password 'https:// example .com/zoomdata/service/upload?source= SourceName &accountId=xxxx' -X PUT -H "Content-Type: application/json" -d '{ "product":"phone","price":100.5,"quantity":1 }' --insecure

You can also upload the array of JSON data. Note that the number of rows must not exceed the value specified for the
max.upload.rows property in zoomdata.properties file (by default is it set to 1000). Otherwise the request will be rejected.

For example:

curl -v --user username:password 'https:// example .com/zoomdata/service/upload?source= SourceName &accountId=xxxx' -X PUT -H "Content-Type: application/json" -d '[ {"product":"phone","price":100,"quantity":1},{"product":"car","price":4000.5,"quantity":1} ]' --insecure

Note that the object field types must be the same as in the sample that has been provided while creating the data source on the API Endpoint page.
For example, if the value of the quantity field is an integer, you can not upload new rows in which the value of the quantity field is a string.

If while uploading the new rows, the quantity field is not available, no data will be uploaded.

  1. Open the terminal window, paste and run the modified cURL. The data will be uploaded.

To add new fields to your data structure, use the POST method. For example, a new field - product category must be added to current data structure. Modify the cURL as follows:

curl -v --user username:password 'https:// example .com/ zoomdata /service/upload?source= SourceName & accountId = xxxx ' -X POST -H "Content-Type: application/json" -d '{"product":"TV","price":400,"quantity":1, "product_category":"electronics"}' --insecure

Was this topic helpful?