Skip to main content

How do I write data to PI Data Archive?

How do I write data to PI Data Archive?

There are several ways to write data to PI, depending on your data source and architecture.

PI Web API (REST)

Write a single value:

POST /piwebapi/streams/{webId}/value
{
  "Timestamp": "2024-01-15T10:30:00Z",
  "Value": 42.5
}

Write multiple values:

POST /piwebapi/streams/{webId}/recorded
{
  "Items": [
    { "Timestamp": "2024-01-15T10:00:00Z", "Value": 41.2 },
    { "Timestamp": "2024-01-15T10:15:00Z", "Value": 42.5 },
    { "Timestamp": "2024-01-15T10:30:00Z", "Value": 43.1 }
  ]
}

AF SDK (.NET)

PIPoint point = PIPoint.FindPIPoint(piServer, "MyTag");

// Single value
point.UpdateValue(new AFValue(42.5, AFTime.Now), AFUpdateOption.Insert);

// Bulk write
var values = new AFValues();
values.Add(new AFValue(41.2, new AFTime("2024-01-15T10:00:00")));
values.Add(new AFValue(42.5, new AFTime("2024-01-15T10:15:00")));
point.UpdateValues(values, AFUpdateOption.Insert);

PI Connector for UFL

For CSV, JSON, or text file ingestion:

  1. Define a .ini file with parsing rules
  2. Point UFL at your data files or set up a REST endpoint
  3. UFL parses and writes to PI automatically

OMF (OSIsoft Message Format)

For modern IoT and edge scenarios:

[{
  "containerid": "MyContainer",
  "values": [{
    "Timestamp": "2024-01-15T10:30:00Z",
    "Value": 42.5
  }]
}]

Write Modes

ModeBehavior
InsertAdd if no value at that timestamp
ReplaceOverwrite existing value
InsertNoCompressionWrite without compression evaluation
RemoveDelete the value at that timestamp

Best Practices

  • Use buffering for reliable delivery — PI Buffer Subsystem queues data if the server is unreachable
  • Batch writes for performance — sending 1,000 values in one call beats 1,000 individual calls
  • Set appropriate point security — not every account should have write access
  • Use Insert mode unless you specifically need to overwrite historical data

Want to ask a follow-up?

PiChat can help with your specific PI System use case. Ask follow-up questions, get code examples, and troubleshoot issues.

Related Questions

Dive Deeper

More Questions

How do I configure PI AF templates?How do I authenticate with PI Web API from Python?What's the difference between snapshot and archive values in PI?What's the difference between PI Vision and PI ProcessBook?How do I build effective PI Vision displays?What are PI Event Frames and how do I use them?How do I write PI AF Analytics expressions?How do I use PI DataLink in Excel?Should I use PI Web API or AF SDK for my application?What are the main components of PI System architecture?How do I optimize PI Data Archive performance?How do I set up the PI Interface for OPC DA?How do I use PI Connector for UFL to import file data?How do I set up PI Data Archive high availability with collectives?What are the security best practices for PI System?How do I migrate PI Data Archive to a new server?How do I connect Power BI to PI System?How do I manage units of measure in PI System?What's the best way to learn PI System?How does PI time syntax work?What are good PI tag naming conventions?How do I access PI System data from Java or Linux?How do I set up PI AF notification rules?How do I use batch requests in PI Web API?How do I connect to PI AF Server using AF SDK in C#?How do I write VBA macros in PI ProcessBook?How does PI data compression work?How do I get real-time streaming updates from PI Web API?How do I troubleshoot PI AF Analysis errors?How do I write SQL queries against PI using PI OLEDB?What is PI interface buffering and how do I configure it?How do I search and query PI Event Frames?What is PI Integrator for Business Analytics?How do I fix the 'Point does not exist' error in PI System?What is the difference between PI ACE and AF Analytics?How do I manually enter data into PI Data Archive?What are AF hierarchy design best practices?What is a WebID in PI Web API and how does it work?How do I configure Kerberos authentication for PI System?Can I deploy PI System in the cloud?How do I calculate summaries (average, total, min, max) in PI?What are PI digital states and how do I use them?How do I connect PI System data to Grafana?How do I backup and restore PI Data Archive?How do I create custom symbols in PI Vision?How do I automate PI System tasks with PowerShell?What is AVEVA Connect and how does it relate to PI System?How do I check and handle data quality in PI System?How do I handle pagination in PI Web API responses?How does AVEVA PI System licensing work?How do I plan a PI System upgrade?