Field API: max_date Parameter

When retrieving a large amount of data through Field API, we often think about performance and efficiency. If you are performing routine tasks, such as nightly sync update, one approach might be to retrieve only the data which are modified after a certain time. If you look at the Field API reference guide, there is a parameter “max_date” for some of methods. Unfortunately, the documentation lacks the detailed explanation about the format it takes. We also found that not every method with this parameter seems to work as expected. So I took a look.

First, in the documentation, the following REST methods list max_date as an optional parameter:

Unfortunately, as of this writing, /api/get_tasks does not reflect this parameter even when it is set. A change request CS-30369 is logged against this. The last two are deprecated methods. So let’s not worry about it.

For others, you can use the following date time format:

“yyyy-MM-dd HH:mm:ss zzz”

In addition to year-month-date, you will need hour-minute-second, and “zzz” means time zone. For example,

“2016-01-01 15:28:17 -0500”

The last -0500 indicates the time zone; i.e., -5 hour from UTC for the east coast of the U.S. (As a side note, internally, this is defaulted as “1900-01-01 00:00:00 +0000”.)

You may ask, “what about issues?”

For Issues, you can use /fieldapi/issues/v1/search to achieve a similar goal. Please take a look at the following post for more detail:

https://fieldofviewblog.wordpress.com/2015/07/28/field-api-search-issues-by-date-updated/

Mikako

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s