Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Insight

Use Chrome Developer tool to capture content

  • Last UpdatedMay 09, 2023
  • 3 minute read

You can use the template from the Chrome Developer tool and a PowerShell script to create content.

To capture AVEVA Insight content for a post request with Chrome Developer tool

  1. Using a Chrome browser, create content in AVEVA Insight.

  2. Press F12 to open the Chrome Developer tool.

  3. In the Chrome Developer tool:

    1. Select the Network tab.

    2. Select ChromeF12_Clear_icon to clear the tool's displayed information.

  4. In AVEVA Insight, save your content.

    CScriptAPI_ChromeEx

  5. In the Developer tool:

    1. Select the "Content" line to see details.

    2. In the General section, note the Request URL:

      Chrome Developer Tool URL request.

    3. In the Request Payload section, copy all the content.

      Chrome developer tool new payload tool.

  6. Paste the request payload into a JSON formatter and make any edits.

    • Remove these items: URL property, CreationDate, LastModifiedDate, LastAccessedDate, and SharedDate, the numeric portion of the UserID (retain the email address), and TenantID.

    • Optionally, modify these items as needed: FavoriteName, UserID (email address only), and UserName.

      Thjs is an example of the resulting code:

      {

      "upsert": {

      "LayoutInfo": {

      "DashboardContents": [

      ],

      "Layout": [

      {

      "Type": "Column Chart",

      "Name": "All Numeric",

      "IsActiveGroup": "true",

      "Tags": [

      ],

      "UIProperties": "{\"version\":{\"major\":1,\"minor\":5,\"timestamp\":\"\"},\"selectedOptions\":{\"limitLine\":{\"visible\":false,\"position\":10,\"text\":\"Limit Line Text\"},\"legend\":{\"visible\":true},\"xAxis\":{\"label\":\"DateTime\"},\"yAxis\":{\"label\":\"All Tags\"},\"dates\":{\"from\":\"2018-11-15T19:30:00.000Z\",\"to\":\"2018-11-15T20:04:33.099Z\"},\"aggregation\":\"Maximum\",\"isChartOptionAvailable\":true,\"isTimeAggregateAvailable\":true,\"isValueAggregateAvailable\":true,\"isCSVDownloadAllowed\":true,\"timeAggregate\":\"15MINUTES\"}}"

      },

      {

      "Type": "",

      "Name": "None",

      "IsActiveGroup": "false",

      "Tags": [

      ],

      "UIProperties": ""

      },

      {

      "Type": "",

      "Name": "65F",

      "IsActiveGroup": "false",

      "Tags": [

      ],

      "UIProperties": ""

      }

      ],

      "TagDetails": [

      {

      "TagName": "Weather.Auckland.Daily Cooling Degrees",

      "IsSelected": "false",

      "Order": "",

      "ColorIndex": "undefined",

      "Color": "#eeeeee"

      },

      {

      "TagName": "Weather.Auckland.Weather ID",

      "IsSelected": "true",

      "Order": "0",

      "ColorIndex": "1",

      "Color": "#AD1457"

      }

      ],

      "TimeAggregate": 3,

      "TimePreset": "OffsetInMilliSecs:1700224"

      },

      "ContentType": 1,

      "ChartType": "Column Chart",

      "Name": "wally_embed for comments123",

      "UserID": "wally.wonderware@gmail.com",

      "CreatedUserFirstName":"Wally",

      "CreatedUserLastName":"Wonderware",

      "Keywords": [

      ],

      "Location": "/",

      "SharedMode": 98

      }

      }

  7. Paste the resulting code (shown below in blue) in Powershell as a POST request.

    For the -Uri parameter, use the Request URL from step 7 (shown in red below).

    For example:

    $header = @{

    Authorization="Bearer <token_ID>";

    "Content-Type"="application/json;charset=UTF-8"

    };

    $postdata='

    {

    "upsert": {

    "LayoutInfo": {

    "DashboardContents": [

    ],

    "Layout": [

    {

    "Type": "Column Chart",

    "Name": "All Numeric",

    "IsActiveGroup": "true",

    "Tags": [

    ],

    "UIProperties": "{\"version\":{\"major\":1,\"minor\":5,\"timestamp\":\"\"},\"selectedOptions\":{\"limitLine\":{\"visible\":false,\"position\":10,\"text\":\"Limit Line Text\"},\"legend\":{\"visible\":true},\"xAxis\":{\"label\":\"DateTime\"},\"yAxis\":{\"label\":\"All Tags\"},\"dates\":{\"from\":\"2018-11-15T19:30:00.000Z\",\"to\":\"2018-11-15T20:04:33.099Z\"},\"aggregation\":\"Maximum\",\"isChartOptionAvailable\":true,\"isTimeAggregateAvailable\":true,\"isValueAggregateAvailable\":true,\"isCSVDownloadAllowed\":true,\"timeAggregate\":\"15MINUTES\"}}"

    },

    {

    "Type": "",

    "Name": "None",

    "IsActiveGroup": "false",

    "Tags": [

    ],

    "UIProperties": ""

    },

    {

    "Type": "",

    "Name": "65F",

    "IsActiveGroup": "false",

    "Tags": [

    ],

    "UIProperties": ""

    }

    ],

    "TagDetails": [

    {

    "TagName": "Weather.Auckland.Daily Cooling Degrees",

    "IsSelected": "false",

    "Order": "",

    "ColorIndex": "undefined",

    "Color": "#eeeeee"

    },

    {

    "TagName": "Weather.Auckland.Weather ID",

    "IsSelected": "true",

    "Order": "0",

    "ColorIndex": "1",

    "Color": "#AD1457"

    }

    ],

    "TimeAggregate": 3,

    "TimePreset": "OffsetInMilliSecs:1700224"

    },

    "ContentType": 1,

    "ChartType": "Column Chart",

    "Name": "wally_embed for comments123",

    "UserID": "wally.wonderware@gmail.com",

    "CreatedUserFirstName":"Wally",

    "CreatedUserLastName":"Wonderware",

    "Keywords": [

    ],

    "Location": "/",

    "SharedMode": 98

    }

    }

    '

    try{

    $response = Invoke-WebRequest -Uri https://online.wonderware.[DOMAINSUFFIX]/apis/explore/v2/Content?overwrite=true -Method
    Post -Body $PostData -Headers $header -ErrorVariable RespErr

    $response;

    }

    catch [System.Net.WebException] {

    if($_.Exception.Response.StatusCode -eq "Conflict"){

    Write-Host "It's a duplicate Content"

    }else{

    Write-Host "The Request failed.";

    $respStream = $_.Exception.Response.GetResponseStream()

    $reader = New-Object System.IO.StreamReader($respStream)

    $ResponseContent = $reader.ReadToEnd();

    $ResponseContent;

    $RespErr;

    }

    }

Related Links
TitleResults for “How to create a CRG?”Also Available in