Zoomdata Version

Using Zoomdata Upload API

You can use the Zoomdata Upload API connector to dynamically upload your data.

Configure this connector in the following way:

  1. Make sure MongoDB is up and running. For more information, see Managing the Upload API as a Streaming Source .
  2. Get the cURL for your data source.
  3. Configure fields and charts settings.
  4. Load your data to Zoomdata.

The table below lists information on the features that for upload API:

Supports Distinct Count? Yes
Supports Live Mode/ Playback? Yes
SparkIt Capable? No
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

CONFIGURING THE CONNECTION

For details about what is provided on each page of the connection process, review the article Source Connection Workflow . Depending on your needs, you can either follow the steps in order from start to finish or jump to a specific section in the connection process:

Getting The cURL

Start

  1. Log into Zoomdata.
  2. Click the Sources menu item.

    F igure 1
  3. Click the Upload API icon.

General Page

  1. Specify the name of your source and add a description (if desired).


Figure 2

API Endpoint Page

The data from your data source are stored in MongoDB.

On this page, you need to provide a sample JSON for creating a collection in a MongoDB. Keep in mind that these are just sample data and they will not be uploaded to Zoomdata. Instead, you can manage your actual data using the cURL.

Perform the steps listed below.

  1. In the Upload Information section, provide a JSON sample data. These data will be used just for fields type and names detection.  Click Validate .
  2. Once successfully validated, the default cURL will be generated in the Example Default cURL Request field

    Figure 3
  3. Click Next to proceed to fields configuration.

Fields Page

The Fields page lets you (1) configure attribute options, (2) create custom labels for the fields in your data source (that will be displayed in the charts), (3) manage the Volume metric, and (4) work with Calculations.

  1. Determine whether the field should be visible or not to the user.
  2. Create unique label names, as needed, for each Label field.
  3. For the Type column, you have the option to edit the field type (although usually you won't need to do this).
  4. For the Configure column, numeric and time-based fields may be edited:
    • Numeric types including Money, Number and Integer - ability to select a default aggregation function
    • Time fields - ability to define the default time pattern and granularity; if the time field provides granularities of hour, minute and second, then a time zone label may be applied
  1. Select fields for Distinct Counts as needed.
  2. Refresh the connection to a particular field, as desired.
  3. Configure Filter Display settings for fields.
  4. Edit the Volume Metric settings, as needed.
  5. Work with Calculations , if available and as needed.
    If you are setting up a new connection, the Calculations section will not be available until after the connection is saved.
  6. Click Next to continue.


Figure 4

Refresh Page

The Refresh page lets you schedule asynchronous jobs to update the source metadata. For guidance to set up a refresh schedule, refer to the article Using the Zoomdata Scheduler .

Charts Page

On the Charts page, you can:

  1. Edit Global Default Settings .
  2. Select the Standard and, if available, Custom chart styles to be used with the data source.
  3. Set default parameters (group, sub-group, colors, sorting, and so on) for each chart style.


Figure 5

Click Finish to save your changes. Once your data connection has been established, it is listed under the My Data Sources section of the page.

Loading Actual Data

To load your actual data, 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