Data Management
PI System
Tech

Navigating PI Web API's Default maxCount Limit: Retrieving Extensive Data Efficiently

Learn how to manage and optimize data retrieval in PI Web API when dealing with maxCount limits, ensuring comprehensive insights from historical data.

Roshan Soni

4 min read

Navigating PI Web API's Default maxCount Limit: Retrieving Extensive Data Efficiently

Accessing historical sensor data is crucial for comprehensive analysis and decision-making. For users of the PI Web API, especially when utilizing the StreamSet or Streams Recorded Data endpoints, encountering limits like the default maxCount parameter can initially seem restrictive. By default, this parameter restricts the number of records returned per API request to 1,000. This can be limiting if you're aiming to gather data that stretches beyond short timespans—for example, aggregating a week's worth of readings.

Here’s a guide on how to effectively manage and optimize data retrieval using the PI Web API, particularly when you want to collect extensive historical readings.

Understanding the maxCount Limit

The maxCount parameter specifically governs the number of records that are returned in one API call. While the default is set to 1,000, users can't simply "remove" this limit for an indefinite number of records. Instead, calculating the anticipated number of records for the data period you're interested in is necessary for setting your maxCount.

Steps to Overcome Data Limits

  1. Estimate Data Volume: Estimate how many records an extended period, like seven days, would generate. For instance, if your data generates around 1,000 records every 30 minutes, extrapolate that for your desired duration.

  2. Set maxCount Appropriately: Use your calculation to adjust the maxCount in your API request URL, allowing for a buffer to account for unexpected additional data points.

GET [PI Web API URL]/streams/{webId}/recorded?startTime={startTime}&endTime={endTime}&maxCount={calculatedNumber}
  1. Check MaxReturnedItemsPerCall: Be aware of MaxReturnedItemsPerCall which is a server-side configuration that caps the maximum maxCount you can request. Ensure your requested maxCount does not exceed this parameter.

  2. Mind Additional Limits: Recognize there may be other server-side constraints, like the ArcMaxCollect tuning parameter, which imposes further limitations on the quantity of returned records.

Implementing Paging for Large Datasets

For extensive data retrieval, consider implementing paging. Paging allows you to manage large datasets by splitting your API requests into smaller, more manageable chunks, effectively working around limitations while minimizing load on the server.

How to Implement Paging

  • Segmentation Strategy: Divide your requested time range into smaller, consecutive segments aligned with your maxCount allowances.
  • Sequential Requests: Make successive API calls for each segment and accumulate the data on the client side.

Conclusion

By taking these approaches to manage the retrieval of large datasets from the PI Web API, users can bypass initial constraints efficiently while ensuring the server's performance remains optimal. Understanding configurations and system limitations, and leveraging paging strategies will enable you to collect and analyze historical data effectively. Such methodologies ensure that data insights are both comprehensive and accessible for in-depth analysis — supporting stronger data-driven decisions.

Tags

#PI Web API
#Data Retrieval
#Data Optimization
#Historical Data
#Configuration

About Roshan Soni

Expert in PI System implementation, industrial automation, and data management. Passionate about helping organizations maximize the value of their process data through innovative solutions and best practices.

Sign in to comment

Join the conversation by signing in to your account.

Comments (1)

Join the discussion about "Navigating PI Web API's Default maxCount Limit: Retrieving Extensive Data Efficiently"

Meet Vyas
83 days ago

yes

September 21, 2025 at 11:00 AM

Related Articles

Developing Expertise in PI System and Related Technologies: A Comprehensive Training Roadmap

This blog outlines a comprehensive training roadmap for developing expertise in the PI System and related technologies. Structured over four weeks, the program covers essential technologies like the PI System, Asset Framework, and various APIs, providing a strong foundation for data management and analytics.

Roshan Soni

Traversing an AF Database Hierarchy to Count All Elements Using OSIsoft AF SDK

Learn how to use the OSIsoft AF SDK in C# to traverse an AF database and count all elements within its hierarchy. This blog post provides a comprehensive guide with code examples for connecting, traversing, and counting AF elements.

Roshan Soni

A Beginner's Guide to Learning the OSIsoft PI System

Unlock the power of real-time data management and analytics with OSIsoft PI System. This beginner's guide provides a structured learning path and key resources to help you effectively learn the PI System.

Roshan Soni