question

RakeshAgarwal-6741 avatar image
0 Votes"
RakeshAgarwal-6741 asked MayankBargali-MSFT commented

Rest API Filters not working while fetching reports from API Management Services

I have a Azure API management service(API Gateway) from which I am trying to fetch analytics data i.e. reports by operation. The Azure docs states the use of '$filter' to filter the data using multiple parameters. My goal is to filter the data based on timestamp and productID. Adding only timestamp filter returns correct data but combining it with 'productId' returns blank data wit response code of 200. Not sure why. I get the same issue when working with Azure API explorer too. Below is my $filter formation. Please help resolve.

'$filter' : "timestamp ge datetime'2021-06-01Y00:00:00' and timestamp le datetime'2021-06-01Y00:00:00' and productId eq '/products/myproduct' "

Document I am referencing : https://docs.microsoft.com/en-us/rest/api/apimanagement/2019-12-01/reports/list-by-operation

azure-api-management
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.

1 Answer

MayankBargali-MSFT avatar image
0 Votes"
MayankBargali-MSFT answered MayankBargali-MSFT commented

Hi @RakeshAgarwal-6741

Welcome to Microsoft Q&A! Thanks for posting the question.
You need to use the filter query as timestamp ge datetime'2021-06-01Y00:00:00' and timestamp le datetime'2021-06-01Y00:00:00' and productId eq 'myproduct'

Hope the above helps. Feel free to get back to me if you need any assistance.

· 2
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.

This absolutely works. I tried multiple combinations but probably missed this one. Not sure why everywhere productID is tagged as '/product/myProduct'. Anyways, thanks a lot for the help.

0 Votes 0 ·

@RakeshAgarwal-6741 As per the ReportRecordContract the productID field response will be path '/products/{productID}' but while filtering you don't have to define the path.

0 Votes 0 ·