The easiest way to call a OpenAPI/odata query from a shell script is via curl command. However, some aspects need to be considered to make it work.
Syntax curl -u user:password -G -X GET -d 'parameters' 'URL'
Example:
curl -u myuser:mypassword -G -X GET -d '$apply=groupby(ID,%20aggregate(portmfs(im_BitsIn%20with%20percentile95%20as%20im_BitsIn),portmfs(im_BitsOut%20with%20percentile95%20as%20im_BitsOut)))&starttime=1490594251&endtime=1493186251&resolution=RATE&$select=ID,Name&$filter=((substringof(%27CA%27,Name)%20eq%20true))&$format=text/csv' 'http://DA-HOST:8581/odata/api/groups'
We have developed the following OpenAPI/Odata query by the GUI, export some IPSLA ICMP variables based on a MTF file for the last 24 hours. We increased the top, as not all was listed;
http://DA:8581/odata/api/icmpmfs?starttime=1501655014&endtime=1501741414&resolution=HOUR&$format=text/csv&$top=3600&$ski…
To use the OdataURL this result in the following curl query;
curl --trace-time -i -b cookies.txt -c cookies.txt -u myuser:mypassword -G -X GET -d 'starttime=1501655014&endtime=1501741414&resolution=HOUR&$format=text/csv&$top=3600&$skip=0&top=100&$expand=device,component&$select=device/Name,component/DisplayName,Timestamp,min_im_AvgResponseTime,max_im_AvgResponseTime,im_AvgResponseTime,im_Attempts,im_SuccessfulAttempts&$filter=((substringof(tolower(%27cip%27),%20tolower(device/Name))%20eq%20true))' 'http://DA:8581/odata/api/icmpmfs' -o IPSLA-03-08-2017_1430.csv