a week ago
Hello,
I have an API call with a date filter and I want to get the information from the last 30 days. So I created a parameter like this:
today-30.days
and called it "Last30days". Then I added the parameter to my API call to be like this:
my_API_call_?$filter=PostingDate gt {Last30Days}
but it's not working and I'm getting the following error:
"A binary operator with incompatible types was detected. Found operand types 'Edm.Date' and 'Edm.String' for operator kind 'GreaterThan'."
Any idea on what would be the right way to do this?
Thanks!
Friday
@Prudvi I was looking at your screenshot again and this is incorrect.
Setting a param name to "$filter=PostingDate%20gt%20" and a value to "today" will create a result with two "=" characters:
$filter=PostingDate%20gt%20=2025-02-14
Workato places "=" between the param name and the value.
The correct way is to set the param as "$filter" and the value as "PostingDate%20gt%20" + a date
Saturday
Hi @gary1 and @Prudvi,
Thanks for explaining the data pill, that makes a lot of sense now!
I've tried the last options you sent, created the variable and selected it from the data pill.
1 - If I use the Path as text, add the URI and the variable from data pill I get this:
code: BadRequest,
message: Expression expected at position 14 in 'PostingDate gt'. CorrelationId: 0a857be3-5129-4966-87ac-71652e8df1e5.
2 - If I use the Path as formula (the =\ and \ are added anyways) )and create a parameter called "$filter" and value as "PostingDate%20gt%20" + a date (I've also tried to not add the Unicode) it ignores the filter... this is what I call (I've also tried removing the "?" from the last character):
This doesn't have the parameter which is on the following screen:
From here, the date from the data pill doesn't appear, and when I go to the next screen, it just ignores everything and gets all data. I also noticed that the parameter name is "$Filter" but on this screen it ignores the "$".
I wonder if this is happening because I have a connection set for all my recipes, so in case it's updated, all recipes will also be updated. I'm selecting this connection instead of using the In App HTTP element you mentioned where I would need to add the token,Id, etc.
Saturday
I don't know if that rings a bell but I've tried to move the whole call (URL and filter) to the variable, and regardless if I use text or formula, the Path ignores it and shows bad request like I was adding nothing ๐ค
Sunday
Hi, a few requests:
Some other notes:
Monday
@gary1 sure! Here are the steps:
Steps:
--------------------------- Text approach:
Variable:
Text Path:
Text Call Preview after I click on "Resume guided setup", I guess it ignores the filter from the data pill here and I can't manually select:
Text Path Error:
I've tried some other variations and I was able to avoid the error, but it ignores the data pill variable for filter and brings all data.
---------------------------------------- Formula Approach:
Formula Path - I've tried some variations here like:
- Adding the filter structure to the string in the path and labeling the parameter as "filter=" or "filter" only.
- Adding the whole path to another variable and have 2 data pills like "Path Data Pill"+"Filter Data Pill".
- Adding the whole filter structure as Parameter name and the filter value as parameter value.
And some others I don't remember now, but all resulted in errors. I was never able to make the Path work in formula mode.
Formula Parameter - Here is where I believe there's a bug you mentioned. I've tried manually updating the parameter name where it says "filter" on the screen below to "$filter" or bringing the "=" sign from the value to the name, but nothing worked. Also, if I add my variable from step 2 to the Parameter formula, this screen ignores the variable data pill:
Formula Path Preview:
Formula Path Error - This is the same error I get for all attempts to use the path as a formula:
Thank you so much for the support, apparently, it's something straightforward but not in this scenario. I couldn't find any other example of API calls using logic resulting in a date to be used as API call filter. This is the last thing I need to make happen, everything else for all other recipes I have is working fine.