Zoomdata Version

This document is intended for Zoomdata's internal use only. The contents of the document are not guaranteed by Zoomdata. If you have been given a copy of this document, it is for your own use only, and you use it at your own risk. Zoomdata will not support any features, procedures, or information provided in this document now or in the future.

Calculations API

You can use the Calculations API to programmatically create calculations (formulas) in a data source.

Getting a List of Existing Calculations

You can retrieve a list of existing calculations by using the REST call demonstrated in the follow curl command.

curl -X
GET -u username:password 'https:// yourserver/zoomdata /service/formulas/preferences'

in which:

  • username and password are your login credentials. You must be an account's administrator to view the calculations available to it.
  • yourserver/zoomdata is your server's IP address or URL followed by its path. Usually, the path is /zoomdata .

Validating a Calculation

You can validate a calculation before creating it by using the REST call demonstrated in the follow curl command.

curl -X POST -u username:password 'https:// yourserver/zoomdata /service/formulas/validate' -d '{"preview":false,"script":"SUM(c_severity)/SUM(c_elementid)","sourceId":"0123456789"}' -H 'Content-Type: application/json' --insecure

in which:

  • username and password are your login credentials.
  • yourserver/zoomdata is your server's IP address or URL followed by its path. Usually, the path is /zoomdata .

In the example above, the payload is delivered in the curl command itself. It can also be delivered in a file. In any event, it must be encoded as a string. Fields used to create a string are detailed below.

  • "preview":"boolean"
  • "script":"SUM(metric1)/SUM(metric2)"
  • "sourceId":"0123456789"
  • "id":null
  • "name":""
  • "fields":[]
  • "userName":""
  • "valid":true

Creating a New Calculation

To create a new calculation, use the REST call demonstrated in the follow curl command.

curl -X POST -u username : password 'https:// yourserver/zoomdata /service/formulas' -d ' {"label":"MyCalc","script":"SUM(metric1)/SUM(metric2)","sourceId":"0123456789","id":null,"name":"","fields":[],"userName":"","valid":true} ' -H 'Content-Type: application/json' --insecure

in which:

  • username and password are your login credentials.
  • yourserver/zoomdata is your server's IP address or URL followed by its path. Usually, the path is /zoomdata .

In the example above, the payload is delivered in the curl command itself. It can also be delivered in a file. In any event, it must be encoded as a string. Fields used to create a string are detailed below.

  • "label":"MyCalc"
  • "script":"SUM(metric1)/SUM(metric2)"
  • "sourceId":"0123456789"
  • "id":null
  • "name":""
  • "fields":[]
  • "userName":""
  • "valid":true