Retrieving object(s) via the API: Date/Time/Datetime

I need to GET app data corresponding to a specific time range (e.g. January 1, 2019 to January 8, 2019). Does the JourneyApps API support querying data via a date and/or datetime range?

If so, what does a range query look like versus a singleton (or "single-object") query? Are there any formatting requirements when performing a time-based query?

Example scenario for context: In my schema I have a DB model named thing. The thing model has the field created_at and the corresponding field type is datetime (<field name="created_at" type="datetime"/>).

  • Can I use 1546326000000 as an argument in my query for finding thing objects in the database or do I need to format this value to an ISO-8601 string (in this case, Tue Jan 01 2019 00:00:00 GMT-0700)?

The query parameters use the same formatting as when you create an object and the details can be found here.

In summary, you can use the following:

date

Any valid date according to the ISO 8601 specification. Any time or timezone components will be stripped. The YYYY-MM-DD format is recommended. Example: "2016-02-27"

datetime

Any valid date and time according to the ISO 8601 specification. The YYYY-MM-DDTHH:MM:SSZ format is recommended. Example: "2016-02-22T14:00:53Z".

2 Likes