cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Syndicate_Admin
Administrator
Administrator

Custom Connector $filter query string parameter does not work

Hello experts,

 

I've just setup a custom connector. Problem I'm facing is the $filter query string parameter does not seem to be properly working.

 

During connector testing all is good, I get a 200 response, expected results. When I go to run the actual flow and pass the exact same $filter string parameter value, I get a 400 error saying the data types are not compatible, see below. Very strange that the custom connector testing does not match the actual flow when being used....is it possible some characters are being automatically escaped in the custom connector testing area but not in the actual flow? I've tried encoding, using compose variable string, etc but I'm stuck. Please help, any advice/input is welcome!

 

Testing - 200 response

Zpg613_0-1625518487840.png

Flow run - 400 response

Zpg613_1-1625518516368.png

 

6 REPLIES 6
Syndicate_Admin
Administrator
Administrator

First, your filter seems like using an exact timestamp. Due the nature of distributed systems a match on exact timestamp may proved to be tricky. Try using a window instead or some other criteria to filter on.

 

Secondly, can you tell us more about how you implemented $fliter in your custom connector and how is it processed in the backend? If you can explain what you are trying to do with this flow in general that will be helpful too.

 

Thirdly, compare the differences between the test environment and prod environment. What are the difference between the two? Are the backend changes same in both prod and test? Can you make the API call using an app such as postman and get same/different results? Testing with postman can be helpful, since it will validate if you backend is returning correct results with the query or not. Once you confirm that, the only remaining thing to check is the connector itself.

 

Hope this helps.

If this reply answers your question or solves your issue, please ACCEPT AS SOLUTION ☑️. If you find this reply helpful, please consider giving it a LIKE 👍.

Syndicate_Admin
Administrator
Administrator

The problem may be odata specific. Try googling for the error message. Please take a look at this see if it helps: https://stackoverflow.com/questions/62196447/odata-filter-datetimeoffset-less-that-date

 

If this reply answers your question or solves your issue, please ACCEPT AS SOLUTION ☑️. If you find this reply helpful, please consider giving it a LIKE 👍.

Syndicate_Admin
Administrator
Administrator

I've been struggling with exactly this, testing different odata filters to see if they work...is there some difference between the testing stage and prod flow - maybe testing stage adds some header or character I don't see?

FYI When I try filtering on another field eg like a text field it seems to work ok. I've also tried passing the filter string first as a PA variable but I have the same issue.

 

Thanks again for the input.

Thanks for the response and appreciate the help.

 

1 - So I have a test version of the API, and I used a specific DateTime in my post above to get an expected result, using Postman. I just changed the filter to a datetime window and got 6 results in the testing stage of the connector and also in Postman...but still get an error in the prod flow that the type entered is not correct.

 

Makes me believe that the prod flow adds some extra characters or the test flow is adding something eg additional header or escaping characters.

 

Testing Connector

Zpg613_1-1625598094121.png

 

Postman (same Get Request)

Zpg613_2-1625598143151.png

 

Prod PA flow

Zpg613_3-1625598338058.png

 

2 - The $filter in the connector is setup as a optional, string. Eventually I was going to use this data to return only the last records modified in the last 1 day. Not sure if I'm missing any configuration here. I left the default empty so I could pass dynamic string value.

 

Zpg613_0-1625597801926.png

 

3 - The setup for the connector and the flow are the same, point to same endpoint/gateway/etc and the test connection results match Postman exactly (above).

Syndicate_Admin
Administrator
Administrator

Still struggling with this, any ideas why the testing environment returns data properly but not in an actual flow?

Syndicate_Admin
Administrator
Administrator

I wouldn't think the test and prod would behave differently. Are you using the same backend API for test and prod?

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Users online (1,804)