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

AVEVA™ Historian

Use Chrome Developer tool to capture content

  • Last UpdatedAug 18, 2022
  • 3 minute read

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

To capture content for a post request with Chrome Developer tool

  1. Using a Chrome browser, create content in AVEVA Historian Client Web.

  2. Press F12 to open the Chrome Developer tool.

  3. In the Chrome Developer tool:

    1. Select the Network tab.

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

  4. In AVEVA Historian Client Web, save your content.

  5. In the Developer tool:

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

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

      Chrome Developer tool showing general information.

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

      Chrome Developer tool showing Request Payload section.

  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": "Quarterly Report",

      "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 = @{

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

    };

    $postdata='{

    "upsert": {

    "LayoutInfo": {

    "DashboardContents": [

    ],

    "Layout": [

    {

    "Type": "Status Board",

    "Name": "All Numeric",

    "IsActiveGroup": "true",

    "Tags": [

    ],

    "UIProperties": "{\"version\":{\"major\":1,\"minor\":5,\"timestamp\":\"\"},\"selectedOptions\":{\"dates\":{\"from\":\"2018-12-01T00:00:00.000Z\",\"to\":\"2018-12-01T03:25:52.108Z\"},\"isCSVDownloadAllowed\":true}}"

    },

    {

    "Type": "",

    "Name": "Minute",

    "IsActiveGroup": "false",

    "Tags": [

    ],

    "UIProperties": ""

    },

    {

    "Type": "",

    "Name": "Hour",

    "IsActiveGroup": "false",

    "Tags": [

    ],

    "UIProperties": ""

    },

    {

    "Type": "",

    "Name": "Second",

    "IsActiveGroup": "false",

    "Tags": [

    ],

    "UIProperties": ""

    }

    ],

    "TagDetails": [

    {

    "TagName": "SysTimeHour",

    "IsSelected": "true",

    "Order": "0",

    "ColorIndex": "0",

    "Color": "#03A9F4"

    },

    {

    "TagName": "SysTimeMin",

    "IsSelected": "true",

    "Order": "1",

    "ColorIndex": "1",

    "Color": "#AD1457"

    },

    {

    "TagName": "SysTimeSec",

    "IsSelected": "true",

    "Order": "2",

    "ColorIndex": "2",

    "Color": "#F57F17"

    }

    ],

    "TimeAggregate": 2,

    "TimePreset": 5

    },

    "ContentType": 1,

    "ChartType": "Status Board",

    "Name": "My Content",

    "Keywords": [

    ],

    "Location": "",

    "SharedMode": 73

    }

    }'

    try{

    $response = Invoke-WebRequest -Uri http://localhost:32569/Historian/v2/Contents -Method Post -Body $PostData -Headers $header -ErrorVariable RespErr -UseDefaultCredentials

    $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