I have a paticular node for eg : /content/site/advisors/jcr:content which consists of a property "cq:allowed templates" whose value consists of multiple string values(array of strings) .I want to add another string value into it using a curl command.Please suggest.
The @Patch
suffix is used by the Sling POST servlet to add or remove values from a multi-value property, for example:
$ curl -u admin:admin -Fmulti@TypeHint="String[]" -Fmulti=one -Fmulti=two -Fmulti=four http://localhost:8080/test
$ curl -u admin:admin -Fmulti@Patch="true" -Fmulti="+three" -Fmulti="-four" http://localhost:8080/test
$ curl http://localhost:8080/test.tidy.json
{
"jcr:primaryType": "nt:unstructured",
"multi": [
"one",
"two",
"three"
]
}
The docs are at https://sling.apache.org/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.html#patch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With