Skip to main content
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
161 days ago

yes

September 21, 2025 at 11:00 AM

Related Articles

Enhancing PI ProcessBook Trends with Banding and Zones: User Needs, Workarounds, and the Road Ahead

A look at the user demand for trend banding/zoning in OSIsoft PI ProcessBook, current VBA workarounds, UI challenges, and how future PI Vision releases aim to address these visualization needs.

Roshan Soni

Migrating PIAdvCalcFilVal Uptime Calculations from PI DataLink to PI OLEDB

Learn how to translate PI DataLink's PIAdvCalcFilVal advanced calculations—like counting uptime based on conditions—into efficient PI OLEDB SQL queries. Explore three practical approaches using PIAVG, PIINTERP, and PICOunt tables, and get tips for validation and accuracy.

Roshan Soni

Understanding PI Web API WebID Encoding: Can You Generate WebIDs Client-Side?

Curious about how PI Web API generates WebIDs and whether you can encode them client-side using GUIDs or paths? This article explores the encoding mechanisms, current documentation, and best practices for handling WebIDs in your applications.

Roshan Soni