Curl to add a value to a multivalued property of a specific node in CQ
I have a paticular node, for example: / content / site / advisors / jcr: content that consists of the property "cq: allowed templates", the value of which consists of multiple string values ββ(array of strings). I want to add a different string value to it using curl command. Please suggest.
+3
source to share
2 answers
The suffix is @Patch
used by the Sling POST servlet to add or remove values ββfrom a multivalued 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
+4
source to share