2 Replies Latest reply on Nov 15, 2016 6:44 PM by schristian

    Batch request error: Parameter 'intervals' is greater than the maximum allowed

    arosenthal

      I am trying to use the PI Web API batch controller to request a streamset for many attributes with the PlotValues method. However, when I have two many webIds in my request I sometimes receive the following error:

      Parameter 'intervals' is greater than the maximum allowed (173).

      Of course the number in the error message changes depending on the parameters of my batch request.

       

      Is there a way for me to calculate how many webIds I can fit in a single batch sub-request resource (which also apparently is limited by a maximum URL length of 65536) based on the value of my 'intervals' parameter for a call to PlotValues? If I can calculate what this upper limit is, then I can split my requests up into multiple sub-requests to get all the data I want.

        • Re: Batch request error: Parameter 'intervals' is greater than the maximum allowed
          Eugene Lee

          Hi Aaron,

           

          The maximum is calculated by 30000/(number of webIds). For example, if you use an 'intervals' parameter of 200, then you can have 150 webIds (subjected to the URL length of course). Assuming a webId has a length of 60, then the length occupied by the webIds will be 150*60=9000 (still within 65536). You will also need to give some allowance for the baseurl and also other parameters (which shouldn't be much).

          1 of 1 people found this helpful
            • Re: Batch request error: Parameter 'intervals' is greater than the maximum allowed
              schristian

              In addition, if you have permissions to change the server's configuration, the maximum number of intervals can be changed with the MaxReturnedItemsPerCall configuration value (which defaults to 150000).  MaxReturnedItemsPerCall is always five times the absolute maximum number of intervals, so the maximum for each WebId can actually be calculated by (MaxReturnedItemsPerCall) / (5 * (number of webIds)).

               

              In case you're wondering where that "five" comes from, the documentation for the GetPlot endpoint has the answer: "Each interval can produce up to 5 values if they are unique, the first value in the interval, the last value, the highest value, the lowest value and at most one exceptional point (bad status or digital state)."