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

AVEVA™ Historian

Create content with PowerShell

  • Last UpdatedApr 21, 2020
  • 1 minute read

This creates a status board using the "All Tags" tag group.

Note: The header requires an API key. For information on creating an API key, see Acquire an API key for data retrieval.

$header = @{

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

};

$PostData = '{

"upsert": {

"Name": "ContentWithScript",

"ChartType": "Status Board",

"LayoutInfo": {

"TagDetails": [

{

"TagName": "Weatherapp.Richmond.Wind Speed"

}

]

}

}

}

'

try{

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

$response;

}

catch [System.Net.WebException] {

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

Write-Host "This is a duplicate content"

}else{

Write-Host "The Request failed.";

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

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

$ResponseContent = $reader.ReadToEnd();

$ResponseContent;

}

}

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