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. enter image description here

+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


Just add the -Fproperty- name = "property with an additional TypeHint:



-Fproperty-name@TypeHint="String[]" -Fproperty-name="first property value" -Fproperty-name="second property value"

etc.

+3


source







All Articles