How to make a GET request using a filter on a datetime property with EspoCRM REST API?

1.1k Views Asked by At

EspoCRM provides a REST API that sadly has only incomplete documentation. Especially the filters that can be used with a GET request are not documented:

where - (array) filters;

From using Firebug I've discovered that a filter consists of three query parameters:

  • where[0][field]=somefield
  • where[0][type]=somoperator
  • where[0][value]=somevalue

Example, filter on name=Foo:

?where[0][field]=name&where[0][type]=equals&where[0][value]=Foo

The meaning of equals is not documented, as are the possible filter types.

Now I want to filter a collection on a datetime field modifiedAt. I have no idea what the proper values for type and value would be to find all entities that have been modified after a given datetime.

How can the EspoCRM REST API be used for this?

1

There are 1 best solutions below

1
On BEST ANSWER

After playing around with the EspoCRM web GUI, I was able to make a search that uses the filter I need. The query parameters are:

  • where[0][type]=after
  • where[0][field]=modifiedAt
  • where[0][value]=2016-06-01 16:12:00
  • where[0][dateTime]=true
  • where[0][timeZone]=Europe%2FBerlin