cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to pass Date filter in any C4C Odata API to fetch Data from C4C

former_member690694
Participant
0 Likes
4,711

Dear Team,

I need to fetch data based on creation on date of Account from Corporate Account collection. Please find below my trial which is not working . Could you please help me how to pass date format in postman get method call as a filter.

https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/CorporateAccountCollection?$filter=Cr... eq '2021-07-16T14:14:32.3678900Z'&$format=json

Getting error- value": "Invalid parametertype used at function 'eq'"

Same error for GT- "value": "Invalid parametertype used at function 'gt'"

Thanks and Regards,

MD.

Accepted Solutions (1)

Accepted Solutions (1)

former_member226
Employee
Employee
0 Likes

Hi,

Pls use "datetimeoffset" while filtering based on datetime including timezone. For e.g. following URL will give all the accounts that have been created later than 2021-07-16T14:14:32.3678900

https://my3XXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/CorporateAccountCollection?$filter=Cr... ge datetimeoffset'2021-07-16T14:14:32.3678900Z'&$format=json

former_member690694
Participant
0 Likes

Thanks it's working fine.

Answers (2)

Answers (2)

arthur_schewe
Explorer
0 Likes

Hello,

I have a similar problem with the "SalesQuoteCollection" entity but I can't solve the problem even with the tips posted here.

If the entity only selects based on the id, I get the record:

...
<d:ValidFromDate>2021-07-28T00:00:00</d:ValidFromDate>
<d:ValidToDate>2021-07-30T00:00:00</d:ValidToDate>
...

If I use the filter for selection with date like this: https://my3....crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/SalesQuoteCollection?$filter=ValidFromDate eq datetimeoffset'2021-07-28T00:00:00'

I get the following error message:

"Invalid parametertype used at function 'eq'"

What exactly am I doing wrong with the filter?

Thanks and best regards

Arthur

ashishsingh1987
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi,

You may also refer below link to get various filter options:

https://userapps.support.sap.com/sap/support/knowledge/en/2330688

former_member690694
Participant
0 Likes

Thank you..!!