Update a time stamp with a changed date in an API call

This article shows a method of updating a date/time stamp of an API endpoint with the changed date/time stamp

If the platform you're integrating with supports updating a date/time stamp property to track changes, this method can be used to achieve the obtained result.

Transformer example: Set Current Time

Within a Transformer, choose a List Mapper. From the Accessor list, choose Pattern accessor. Fill in the Pattern time

Then configure the Mapper. Choose List: Inherit from supplied data.

Fill in the following JSON:

{
"time": null
}

The result:

Schermafbeelding 2021-01-13 om 13.25.13

Then, add a new Transformer, the Value Mapper.

From the Accessor list, choose Pattern accessor, and again fill in the Pattern time

Then choose the Mapper Format: Date

  • The input for Output format must contain: Y-m-d H:i:s
  • The input for Input format must contain: Automatic
  • The input for Output timezone must contain: Automatic
  • The input for Input timezone must contain: Automatic

Formatting the aforementioned inputs needs to be according to PHP standards. Please visit this PHP website for more information. 

The result:

Schermafbeelding 2021-01-13 om 13.36.23

And you're set! You've created a new property with the value null. Then the property will be formatted as a date. Because the date is null, the current date will be used.