Question

I am currently using WCF Web API Preview 5 and am trying to filter a list of users where the LastModifiedDate is greater than or equal to the provided datetimeoffset:

 http://api.myapp.com/users?$filter=LastModifiedDate ge datetimeoffset'2011-06-01T14:03:00+00:00Z'

However all I am getting is an error saying:

Microsoft.ApplicationServer.Query.ParseException: '.' or '(' expected (at index 34)

The filtering seems to be working fine as this filter returns the requested user

http://api.myapp.com/users?$filter=UserId eq 1

-- XML Response
<?xml version="1.0" encoding="utf-8"?>
<ArrayOfUser xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <User>
    <ExtensionData />
    <CreateDate />
    <CreatedById>1</CreatedById>
    <IsDeleted>false</IsDeleted>
    <LastModifiedById>1</LastModifiedById>
    <LastModifiedDate />
    <Name>Joe</Name>
    <UserId>1</UserId>
  </User>
</ArrayOfUser>

-- JSON Response
[
  {
    "CreateDate":
    {
      "DateTime":"\/Date(1306481778297)\/",
      "OffsetMinutes":0
    },
    "CreatedById":1,
    "IsDeleted":false,
    "LastModifiedById":1,
    "LastModifiedDate":
    {
      "DateTime":"\/Date(1306936979717)\/",
      "OffsetMinutes":0
    },
    "Name":"Joe",
    "UserId":1
  }
]

Just cannot get it working with the DateTimeOffset filter so am I creating the filter incorrectly? Or is there something else at play?

Was it helpful?

Solution

Did you try

http://api.myapp.com/users?$filter=LastModifiedDate ge datetimeoffset('2011-06-01T14:03:00+00:00Z')

or

http://api.myapp.com/users?$filter=LastModifiedDate ge (datetimeoffset'2011-06-01T14:03:00+00:00Z')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top