Use a URL-based query to create charts
- Last UpdatedApr 08, 2020
- 3 minute read
You can create an Insight chart from a URL query. This is useful when you want to trigger the creation of an Insight chart from another application.
Note: You must be signed into the Insight solution that corresponds to the data you reference before you can query it.
Parts of a URL-based query
The query must be in this format:
<base URL>?Tags=<tag list><optional parameters, where parameters are joined by "&">
Here is an example of a URL-based query specifying chart parameters:
https://online.wonderware.[DOMAINSUFFIX]/explore?tags=WeatherApp.Auckland.Cloudiness&chartType=LineChart&startTime=2017-03-29T08:45:00.000&endTime=2017-03-30T08:45:00.000
The URL-based query includes these parts:
|
Part of the query URL |
In the example, it looks like this: |
|
The base URL |
https://online.wonderware.[DOMAINSUFFIX]/explore |
|
An indicator showing that parameters are to follow |
? |
|
Query parameters |
tags=WeatherApp.Auckland.Cloudiness |
Syntax notes
For Chart URL, a comma is a special character. If you need to comma-separate multiple tags, you must do one of the following:
-
Replace "," with "\,".
-
Use a double-encoded tag.
-
To create a double-encoded tag
-
From the browser, press F12 to open the Developer Console.
-
Type following command, replacing "TagName" with actual the tag name, and press ENTER:
encodeURIComponent(encodeURIComponent("TagName"))
For example:
-
First, type:
encodeURIComponent(encodeURIComponent("Weather California"))
This generates the double-encoded tag :
'Weather%2520California'
-
Next, use that as the tag name within your query:
https://online.wonderware.com/explore?tags=Weather%2520California
-
Supported query parameters
These query parameters are supported. While tag names are case-sensitive, parameters are not. (Parameters are case-insensitive.)
|
Parameter |
Description |
|||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Tags |
(required) Defines the tags to include in the chart. Use the case-sensitive, fully qualified name for each tag (that is, the data source name plus the tag name). Separate tag names with commas. For example: Tags=MyDataSource.Pump12.Temp\,MyDataSource.Pump12.Speed |
|||||||||||||||
|
ChartType |
Specifies the type of chart to use. Valid chart types are:
Note: CumulativeSum and RollingSum are the same thing. Both are available for backward compatibility. For example: ChartType=ColumnChart Default: StatusBoard |
|||||||||||||||
|
StartTime |
Specifies the when the reporting time period begins, using this format: yyyy-MM-dd'T'HH:mm:ss.fff For example: StartTime=2017-03-27T08:47:40.763 StartTime is in local time (ISO format) for the client computer. Default: Today |
|||||||||||||||
|
EndTime |
Specifies the when the reporting time period begins, using this format: yyyy-MM-dd'T'HH:mm:ss.fff For example: EndTime=2017-03-28T12:47:40.763 EndTime is in local time (ISO format) for the client computer. Default: Today |
|||||||||||||||
|
DurationHours |
Specifies the duration to report, in hours. DurationHours is used only if provided. For example: DurationHours=2 |
|||||||||||||||
|
sliceBy |
Specifies the event aggregate in a column chart. This parameter accepts the fully qualified name of a non-analog tag. If sliceBy is provided in the URL along with resolution or timeAggregate, those parameters are ignored and event aggregate is selected for the chart. If no tag name, or an invalid tag name, is provided for sliceBy, the sliceBy option is ignored. For example: sliceBy=IntouchAlarm.ConcValve1 |
|||||||||||||||
|
resolution |
Specifies a time aggregate in milliseconds for a chart supporting time aggregate options. Accepted values are 86400000 (DAY), 3600000 (Hour) and 900000 (15 Min). For example: resolution=900000 |
|||||||||||||||
|
timeAggregate |
Specifies a time aggregate in daily or hourly values for a chart supporting time aggregate options. Valid values are: Day, Hour,15minutes, or Event. Alternatively, you can provide 1,2,3 or 4 for Day,Hour,15minute, or Event, respectively If the sliceBy query parameter is used, then timeAggregate is automatically set to Event and any other timeAggregate option is ignored For example: timeAggregate=Day If resolution and timeAggregate are both provided, only resolution is considered. |
|||||||||||||||
|
valueAggregate |
Specifies a value aggregate for a chart supporting value aggregate options. Valid values are minimum, maximum, integral, average, or last as long as the value is valid for the corresponding chart. |
About StartTime, EndTime, and DurationHours
You do not need to specify StartTime, EndTime, and DurationHours.
-
When all three are specified, Insight uses StartTime and EndTime, but ignores DurationHours.
-
When either StartTime or EndTime is specified along with DurationHours, the two specified parameters are used for StartTime/EndTime calculations.
-
When either StarTime or EndTime is specified without DurationHours, CurrentTime and the specified parameter are used for StartTime/EndTime calculations.
-
When none of these three parameters are specified, the chart shows tag values for today ending with the current time.
Example
For example, after logging into the corresponding Insight solution for the data you want charted, you could type this URL in a web browser:
https://online.wonderware.[DOMAINSUFFIX]/explore?DurationHours=4&tags=EM_Counter.Batch.Counter&chartType=LineChart
This chart would display:
