I need to fetch task objects which are completing today using Rest API , Can anyone please suggest how can we use today option to filer the data?

I am using below query:

/api/Objects/Task?$filter=AssignmentFinish ge '" + today.toISOString() + "'

but getting an error as given below:

"ExceptionMessage": "Unrecognized 'Edm.String' literal 'datetime'\" today.toISOString()

Any help will be much appreciated.

  • is AssignmentFinish is date field? – Ganesh Sanap Dec 13 '18 at 10:53

Here is how you can filter dates in REST:

$filter=StartDate ge datetime'2014-01-01T00%3a00%3a00'

This filters for items created after 01-Jan-2014, 00:00:00.

So to filter between two date ranges, simply add another condition to the filter:

$filter=(StartDate ge datetime'2014-01-01T00%3a00%3a00') and (EndDate le datetime'2014-04-30T00%3a00%3a00')

This filters for items created between 01-Jan-2014 and 01-May-2014.

Just create your dates in the format: YYYY-MM-DDTHH:MM:SS, and then encode it (or simply use %3a instead of the colons).

  • Does this answer helps you? – Ganesh Sanap Dec 13 '18 at 12:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.