How to specify a Yesterday Time Range in OpenAPI queries

Document ID : KB000097790
Last Modified Date : 06/06/2018
Show Technical Document Details
Introduction:
OpenAPI Query Builder in CA Performance Management provides a set of default Time Ranges that can be selected to limit the amount of data in a report.

A custom time range is also able to be set but none exists for 'Yesterday'. For example if the query is launched on 7/4/1776 @ 2 PM, it would provide the last 24 hours of data, from 12 AM to 11:59 PM, for 7/3/1776. 
Question:
Need to use this in setting up the query to be run on a scheduled bases using a VBS .bat script.

Without being able to set 'Yesterday' as a range and allowing the query to select the correct data set given the date it's run on, the process becomes a manual time consuming administrative problem.

Is there a way to accomplish this without at this time resorting to one of these options?
  • Run the URL daily
    • Each time you must change the time frame to match the Yesterday range sought
  • Run the URL using 'Last 3 Days' or a large Custom Time Range covering the desired Yesterday Time Range
    • Cut the relevant Yesterday data out of the resulting data set based on polled data point time stamps
Environment:
All supported CA Performance Management releases
Answer:
The current set of time frames available for selection within the OpenAPI tool are present by design. Adding new time range filters to the OpenAPI options would be an Enhancement Request. To submit an Enhancement Request please post an Idea to the CA Performance Management Community site found here.

A solution if using VBS scripts that was tested and appears to work well is:

Dim yesterday : yesterday=DateAdd("d",-1,Date()) 

For example something like: 

"http://<DA_HOST>:8581/odata/api/interfaces?&resolution=RATE&starttime=" &yesterday &"T00:00&period=1d&tz=Server Time Zone (Default)&$expand=portmfs&$select=DisplayName,portmfs/im_Utilization" 

Starttime is yesterday's date at midnight (00:00) for 1 day.(1d).