cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Issue with Date Parameter in API call filter

camaliontij
Deputy Chef I
Deputy Chef I

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!

23 REPLIES 23

gary1
Executive Chef III
Executive Chef III

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.

camaliontij
Deputy Chef I
Deputy Chef I

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"

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.
APICall.jpg
Regards,
Prudvi

camaliontij
Deputy Chef I
Deputy Chef I

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:

Path.png