question

suvrajyoti-2505 avatar image
0 Votes"
suvrajyoti-2505 asked MikeUrnun commented

Using $Select and $Filter together

Hi,

I am using the below Azure APIM Rest API for getting API usage by API Operation

https://docs.microsoft.com/en-us/rest/api/apimanagement/2019-12-01/reports/listbyoperation

Below is my Request Uri:

var requestUri = String.Format("reports/byOperation?$filter=timestamp ge datetime'2021-05-19T00:00:00' and timestamp le datetime'2021-05-21T00:00:00' and subscriptionId eq '{0}'&$orderby=callCountTotal desc&api-version=2019-12-01&$top=20", subscription);

This returns me the response having below fields.

"value": [
{
"name": "abcd",
"apiId": "/apis/95bf5ea7295646b8acd33dd6d6d18b74",
"operationId": "/apis/95bf5ea7295646b8acd33dd6d6d18b74/operations/abcd",
"callCountSuccess": 0,
"callCountBlocked": 0,
"callCountFailed": 0,
"callCountOther": 0,
"callCountTotal": 0,
"bandwidth": 0,
"cacheHitCount": 0,
"cacheMissCount": 0,
"valueCacheHitCount": 0,
"valueCacheMissCount": 0,
"apiTimeAvg": 0.0,
"apiTimeMin": 0.0,
"apiTimeMax": 0.0,
"serviceTimeAvg": 0.0,
"serviceTimeMin": 0.0,
"serviceTimeMax": 0.0
},
{
"name": "efghijk",
"apiId": "/apis/1b17047c23de4a3b9b77f2d4063376da",
"operationId": "/apis/1b17047c23de4a3b9b77f2d4063376da/operations/efghijk",
"callCountSuccess": 0,
"callCountBlocked": 0,
"callCountFailed": 0,
"callCountOther": 0,
"callCountTotal": 0,
"bandwidth": 0,
"cacheHitCount": 0,
"cacheMissCount": 0,
"valueCacheHitCount": 0,
"valueCacheMissCount": 0,
"apiTimeAvg": 0.0,
"apiTimeMin": 0.0,
"apiTimeMax": 0.0,
"serviceTimeAvg": 0.0,
"serviceTimeMin": 0.0,
"serviceTimeMax": 0.0
},
]

How can I get a response that has only these below fields?

   "name": "abcd",
   "apiId": "/apis/95bf5ea7295646b8acd33dd6d6d18b74",
   "operationId": "/apis/95bf5ea7295646b8acd33dd6d6d18b74/operations/abcd",
   "callCountTotal": 0

I understand we can apply $Select for the same, but how should i apply the same along with $filter? I am facing issues like "Invalid select clause". Providing an example will be a lot of help.

Thanks,
SuvraJyoti

azure-api-management
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @suvrajyoti-2505 $Select doesn't appear to be included in the list of supported parameters though: https://docs.microsoft.com/en-us/rest/api/apimanagement/2019-12-01/reports/listbyoperation#uri-parameters

I will confirm with the APIM team and update you here soon.

0 Votes 0 ·

0 Answers