Querying records in a date range

From DreamFactory
Jump to: navigation, search
DreamFactoryTutorialsQuerying records in a date range
Line 1: Line 1:
 
### Tutorial
 
### Tutorial
  
Query a SQL or NoSQL database for records 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.
+
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.
 
Note that filter strings are simply SQL queries with ordinary SQL operators, including <, <=, >, >=, =, etc.

Revision as of 19:29, 15 October 2015

      1. Tutorial

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.

      1. API Endpoint
GET https://{url}/api/v2/{api_name}/_table/{table_name}?filter={filter_string}
      1. API Docs Screenshot

Swagger-date-filter.png

      1. 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
      1. 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%20contacted_date%20%3C%3D%202015-10-31