Update Date type fields using Assets HTTP API | Community
Skip to main content
Community Advisor
October 10, 2023
Solved

Update Date type fields using Assets HTTP API

  • October 10, 2023
  • 2 replies
  • 867 views

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.
Best answer by EstebanBustamante

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.

 

2 replies

kautuk_sahni
Community Manager
Community Manager
October 10, 2023

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

Kautuk Sahni
EstebanBustamante
Community Advisor and Adobe Champion
EstebanBustamanteCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
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