You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Xavi Beumala <xb...@adobe.com> on 2011/06/13 18:53:24 UTC

Content creation based on a JSON object

Hi all,

I'm creating content structures using the slingPostServlet by passing a JSON object. In the Sling documentation it says that this is an :operation=import and it works perfectly :)

Is there any major difference I should take into consideration compared to when I create content using a simple key/value post request? Is the import process different to POST content creation other than the JSON format of the object to be created?

On the other hand, if I specify :replace to replace the entire object graph and the node is versionable will a new version of the node be checked in? Or does the import remove the to-be-replaced node an create a complete new one?

Many thanks for your help
Xavi

Re: Content creation based on a JSON object

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,

On Mon, Jun 13, 2011 at 6:53 PM, Xavi Beumala <xb...@adobe.com> wrote:
> I'm creating content structures using the slingPostServlet by passing a JSON object. In the Sling documentation it says that this is an :operation=import and it works perfectly :)
>
> Is there any major difference I should take into consideration compared to when I create content using a simple key/value post request? Is the import process different to POST content creation other than the JSON format of the object to be created?

It is different in that it uses Sling's ContentImporter service, which
is also used for initial content loading for example.

I don't think there are major differences but it's obviously less fine-grained.

>
> On the other hand, if I specify :replace to replace the entire object graph and the node is versionable will a new version of the node be checked in? Or does the import remove the to-be-replaced node an create a complete new one?...

I'm not familiar with the automatic versioning features of the post
servlet unfortunately - looking at the ImportOperation code I'd say
those are handled in the same way as with other POST operations, in
the AbstractCreateOperation and AbstractPostOperation classes.

-Bertrand