โ02-12-2025 01:09 PM
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!
โ02-12-2025 01:31 PM - edited โ02-12-2025 01:31 PM
You need to figure out how to encode/format an Edm.Date value. You're passing "YYYY-MM-DD", which is a string. In order for the application to recognize the string as an Edm.Date, you might need to encode it differently, like "YYYY-MM-DDT00:00:00" (this is a guess, as an example only).
When the API returns date info, how are they formatted? Try to match that format.
โ02-13-2025 04:28 AM
Hi gary1,
The format in the API call is "2025-01-31T23:59:59Z", the parameter I created is set to Date Time and the formula is this "=today-30.days"
โ02-13-2025 05:09 AM - edited โ02-13-2025 05:15 AM
Hi @camaliontij,
Can you share the request URL along with headers which you are passing.
I created a variable X which is of DateTime Type and
in Request URL, I changed it to formula mode and passed it in the following way.
Regards,
Prudvi
โ02-13-2025 05:14 AM - edited โ02-13-2025 05:19 AM
Not the exact request but it's something like this:
https://api.businesscentral.dynamics.com/v2.0/ID/Production/api/DF/prod/v2.0/Companies(ID)/DFSPIFFDe... gt {Last30Days}
Where the formats are:
- PostingDate = YYYY-MM-DD
- If I use "YYYY-MM-DDTHH:mm:SSZ" it works fine
- But it doesn't accept the date_time parameter I created in Workato with =today-30.days
This is the Path I'm using: