Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-1816

REST - Create node fails when jcr:mixinTypes specified after fields it declares

XMLWordPrintable

    • Hide

      Declare mixin and node type which doesn't allow any attributes to be written. Then execute presented-like CURL statements.

      Show
      Declare mixin and node type which doesn't allow any attributes to be written. Then execute presented-like CURL statements.
    • Hide

      Send request twice to initialize the node with required mixin.

      Show
      Send request twice to initialize the node with required mixin.

      Create node using POST method fails when request data contains jcr:mixinTypes="..." after attributes it declares. Below is sample curl which fails, quark:contact doesn't allow to insert any attributes, so quarkmix:contactPostalAddress must be mixed to store street name:

      curl -XPOST -HContent-type:application/json --data "{\"quark:type\":\"POSTAL_ADDRESS\",\"jcr:title\":\"Address\",\"quark:street\":\"The Street\",\"jcr:mixinTypes\":[\"quarkmix:contactPostalAddress\"],\"jcr:primaryType\":\"quark:contact\"}" http://localhost:8080/modeshape-rest/myrepo/default/items/foo
      

      And valid one - same except jcr:mixinTypes has been moved before mentioned attributes it declares - creates node without any problem:

      curl -XPOST -HContent-type:application/json --data "{\"quark:type\":\"POSTAL_ADDRESS\",\"jcr:title\":\"Address\",\"jcr:mixinTypes\":[\"quarkmix:contactPostalAddress\"],\"quark:street\":\"The Street\",\"jcr:primaryType\":\"quark:contact\"}" http://localhost:8080/modeshape-rest/myrepo/default/items/foo
      

      Mixin is defined as:

      [quarkmix:contactPostalAddress] mixin
      	- quark:street (STRING) COPY
      	- quark:streetNumber (STRING) COPY
      	- quark:apartment (STRING) COPY
      	- quark:zipCode (STRING) COPY
      	- quark:city (STRING) COPY
      	- quark:province (STRING) COPY
      	- quark:country (STRING) COPY
      

      Best regards.

              rhauch Randall Hauch (Inactive)
              orsonek Bart Cane (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: