Querying records in a date range

From DreamFactory
Jump to: navigation, search
DreamFactoryTutorialsQuerying records in a date range

GET records in a SQL or NoSQL database within a date range using a filter string. Try these examples in the 'API Docs' tab of the DreamFactory Admin Console or from the command line with cURL.

Note that filter strings are simply SQL queries with ordinary SQL operators, including <, <=, >, >=, =, etc.

API Endpoint

GET https://{url}/api/v2/{api_name}/_table/{table_name}?filter={filter_string}

API Docs Screenshot

Swagger-date-filter.png

Example - GET contact records with contacted_date equal to October 1, 2015

  • Table name: contact
  • Filter parameter in API call:
    contacted_date = 2015-10-01
  • Request URL:
    https://foo.com/api/v2/db/_table/contact?filter=contacted_date%20%3D%202015-10-01

Example - GET contact records with contacted_date in the month of October, 2015

  • Table name: contact
  • Filter parameter in API call:
    (contacted_date >= 2015-10-01) AND (contacted_date <= 2015-10-31)
  • Request URL:
    https://foo.com/api/v2/db/_table/contact?filter=(contacted_date%20%3E%3D%202015-10-01)%20AND%20(contacted_date%20%3C%3D%202015-10-31)