AnsweredAssumed Answered

Call Limit PI Web API Batch Call

Question asked by JulianWbr on Nov 2, 2018
Latest reply on Nov 9, 2018 by JulianWbr

Hi there,

 

I have a Batch Call to the PI Web API that gets me a bunch of Event Frames. For each EF I need the Attributes and its values. So I Added them to the Batch Call. the next step the customer needed was the Limits to several Attributes. So I get the Child Attributes of the Attributes and checked for Hi and Lo Limits and when found I get the values.
In my test environment that works out for me, but when I tested it live the error Message "To many calls to the Web API" or something like that appeared.

 

My question is how can I avoid this error?

 

Here is my Batch Call:

 

 

let pirequestElement: PIRequest = {

 

   Method: 'GET',

   // tslint:disable-next-line:max-line-length

   Resource: this.pibaseURL + '/assetdatabases?path=\\\\' + this.piAssetServer + '\\' + this.piAFDatabase + '&selectedFields=WebId;Path;Links',

   Headers: {

   'Cache-Control': 'no-cache'

  },

   Parameters: [

   // '$.' + requestnumber + '.Content.Items'

  ],

  };

   pirequest['database'] = pirequestElement;


   // Hole die zugehörigen Fingerprints

   const endDate = '*';

   // Addiere die Anzahl der Tage und gehe n Tage zurück.

   const startDate = '-' + days + 'd';

   pirequestElement = {

   Method: 'GET',

   // tslint:disable-next-line:max-line-length

   Resource: '{0}?templateName=Fingerprint&searchMode=StartInclusive&selectedFields=Items.Links;Items.Name;Items.StartTime;Items.EndTime&startTime=' + encodeURI(startDate) + '&endTime=' + encodeURI(endDate),

   Headers: {

   'Cache-Control': 'no-cache'

  },

   ParentIds: ['database'],

   Parameters: [

   '$.database.Content.Links.EventFrames'

  ],

  };

   pirequest['fingerprintEvents'] = pirequestElement;


   // Hole nur bestimmte Values zu den Fingerprint-Events

   pirequestElement = {

   Method: 'GET',

   // tslint:disable-next-line:max-line-length

   Headers: {

   'Cache-Control': 'no-cache'

  },

   RequestTemplate: {

   Resource: '{0}?selectedFields=Items.WebId;Items.Path;Items.Links;Items.Name;Items.Value&nameFilter=*'

  },

   ParentIds: ['fingerprintEvents'],

   Parameters: ['$.fingerprintEvents.Content.Items[*].Links.Value']

  };

   pirequest['fingeprintValues'] = pirequestElement;


   // Hole alle Attribute des Event Frames

   pirequestElement = {

   Method: 'GET',

   // tslint:disable-next-line:max-line-length

   Headers: {

   'Cache-Control': 'no-cache'

  },

   RequestTemplate: {

   Resource: '{0}?selectedFields=Items.WebId;Items.Path;Items.Links;Items.Name;Items.Value&nameFilter=*'

  },

   ParentIds: ['fingerprintEvents'],

   Parameters: ['$.fingerprintEvents.Content.Items[*].Links.Attributes']

  };

   pirequest['fingeprintAttributes'] = pirequestElement;

 

   // Hole nun die Werte für die unter Attribute welche nun die Limits sind.

   pirequestElement = {

   Method: 'GET',

   // tslint:disable-next-line:max-line-length

   Headers: {

   'Cache-Control': 'no-cache'

  },

   RequestTemplate: {

   Resource: '{0}?selectedFields=Items.WebId;Items.Path;Items.Links;Items.Name;Items.Value&nameFilter=*'

  },

   ParentIds: ['fingeprintAttributes'],

   Parameters: ['$.fingeprintAttributes.Content.Items[*].Content.Items[*].Links.Attributes']

  };

   pirequest['fingeprintAttributesLimits'] = pirequestElement;


   // Hole nun die Values für die Limits

   pirequestElement = {

   Method: 'GET',

   // tslint:disable-next-line:max-line-length

   Headers: {

   'Cache-Control': 'no-cache'

  },

   RequestTemplate: {

   Resource: '{0}?nameFilter=*'

  },

   ParentIds: ['fingeprintAttributesLimits'],

   Parameters: [

   '$.fingeprintAttributesLimits.Content.Items[*].Content.Items[*].Links.Value'

  ]

  };

   pirequest['fingeprintValuesLimits'] = pirequestElement;

Outcomes