Skip to main content
ShubhanshuSi2
Community Advisor
Community Advisor
October 10, 2023
Solved

Update Date type fields using Assets HTTP API

For a client we are leveraging Assets HTTP API for metadata updates on AEM as CS, there are certain metadata attributes which are of type Date or Long. What is the expected input format for Date and Long type fields in request body?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
EstebanBustamante
EstebanBustamanteAccepted solution
Adobe Champion and Community Advisor
October 10, 2023

Hi @shubhanshusi2 

 

The body is a JSON payload, which means that all your values will be represented as strings. With that said, you simply need to use the string representation of the respective value type. If you intend to update a Date or Long metadata property, ensure that you provide a valid string representation for the date or long value in the corresponding field. Failing to do so may not trigger any warnings or errors, but it could lead to malfunctions in any logic that relies on such metadata

 

For example, this is how I will update a Date:


Hope this helps.

 

Esteban Bustamante

2 replies

kautuk_sahni
Level 9
October 10, 2023

@estebanbustamante @shashi_mulugu  Can you please review this Question and share your thoughts? 

Translate
Kautuk Sahni
EstebanBustamante
Adobe Champion and Community Advisor
EstebanBustamanteAdobe Champion and Community AdvisorAccepted solution
Adobe Champion and Community Advisor
October 10, 2023

Hi @shubhanshusi2 

 

The body is a JSON payload, which means that all your values will be represented as strings. With that said, you simply need to use the string representation of the respective value type. If you intend to update a Date or Long metadata property, ensure that you provide a valid string representation for the date or long value in the corresponding field. Failing to do so may not trigger any warnings or errors, but it could lead to malfunctions in any logic that relies on such metadata

 

For example, this is how I will update a Date:


Hope this helps.

 

Translate
Esteban Bustamante