Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

Updating Specific Array values within a content fragment using PUT call request

Avatar

Level 2

We have a multifield content fragment and we are using Assets HTTP API in order to update this content fragment.

 

We want to specifically update just the 2nd String from the list of multifield values but the PUT call request is expecting the entire request body.  Is there a way to just target the second value? Attached is the PUT call request for reference.

 

{
"properties": {
"cq:model": "/conf/infocus/settings/dam/cfm/models/testModel",
"name": "test",
"elements": {
"items": {
"value": [
"{\"value\":\"testPath\",\"key\":\"heroImagePath\"}",
"{\"value\":\"testPath\",\"key\":\"title\"}"
]
}
}
}
}

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

No, Assets HTTP API - using PUT - we have to send all values of an Asset.

 

Unfortunately, there's no way to directly update a single value in a set of values using the Assets HTTP API's PUT method. You must send the entire updated set of values in your PUT request.

View solution in original post

3 Replies

Avatar

Community Advisor

can you try get the existing / current values and update only 2nd value and send back all with PUT

 

  1. Make a GET request to get the current values of the multi-value property.
  2. Parse the response to extract the current values.
  3. Update the second value in the list of values.
  4. Make a PUT request to update the multi-value property with the new values.

Avatar

Level 2

Thanks @SureshDhulipudi 

Is there a way to only do a specific second value update using the PUT call?

Avatar

Correct answer by
Community Advisor

No, Assets HTTP API - using PUT - we have to send all values of an Asset.

 

Unfortunately, there's no way to directly update a single value in a set of values using the Assets HTTP API's PUT method. You must send the entire updated set of values in your PUT request.