Jahia in English > create content with...

0 (0 Good)
0 (0 Bad)

create content with rest API's

by  jahianewbie »  2012/08/30 17:11

I have been through http://www.jahia.com/community/documentation/jahiapedia/jahia-modules/rest.html

I am trying to create content - but as i see i need to login (have session) to create content.

Login is fine if i am trying to add content using form which is part of jahia application (dog example).

Wondering if there is a programatic way where in i can create content & provide login details as part of content creation call?

 

  • create content with rest API's
    2012/08/30 17:11

    jahianewbie <p> I have been through&nbsp;http://www.jahia.com/community/documentation/jahiapedia/jahia-modules/rest.html</p> <p> I am trying to create content - but as i see i need to login (have session) to create content.</p> <p> Login is fine if i am trying to add content using form which is part of jahia application (dog example).</p> <p> Wondering if there is a programatic way where in i can create content &amp; provide login details as part of content creation call?</p> <p> &nbsp;</p>

  • Number of messages  2
    Registration date Aug 30, 2012
    0 (0 Good)
    0 (0 Bad)

    Re: create content with rest API's

    by  glucazeau »  2012/08/30 18:32

    Hello,

    I am not sure to understand what you want to do. You can have two different requests, a login one and a create content one, and you shouldn't have any problems.

    Could you please explain where you're having an issue so that I can help you more?

    Regards

    Guillaume

  • Re: create content with rest API's
    2012/08/30 18:32

    glucazeau <p> Hello,</p> <p> I am not sure to understand what you want to do. You can have two different requests, a login one and a create content one, and you shouldn&#39;t have any problems.</p> <p> Could you please explain where you&#39;re having an issue so that I can help you more?</p> <p> Regards</p> <p> Guillaume</p>

  • Number of messages  93
    Registration date Aug 30, 2012
    0 (0 Good)
    0 (0 Bad)

    Re: Re: create content with rest API's

    by  sjourniac »  2012/08/31 08:39

    As Guillaume said, you will have to be authenticated before creating content which involved at least 2 requests.

    What you can do is to call a login ajax function, and for success return, call your post data function. Your final form will have user and password fields to be used by the login function and other fields for the real data creation.

    For the user experience, he will just have to submit once to be able to create content.

    Best regards

    Stephane

  • Re: Re: create content with rest API's
    2012/08/31 08:39

    sjourniac <p> As Guillaume said, you will have to be authenticated before creating content which involved at least 2 requests.</p> <p> What you can do is to call a login ajax function, and for success return, call your post data function. Your final form will have user and password fields to be used by the login function and other fields for the real data creation.</p> <p> For the user experience, he will just have to submit once to be able to create content.</p> <p> Best regards</p> <p> Stephane</p>

  • Number of messages  1
    Registration date Aug 31, 2012
    0 (0 Good)
    0 (0 Bad)

    Re: Re: create content with rest API's

    by  jahianewbie »  2012/09/02 14:16

    i have no web application. I have a sandalone application which will ingest data. Here I will first need to use login call & later create content call.

    I am wondering if there is a way where in I use only one call to create content. I can supply login credentials credentaials. 

    I am trying to avoid 2 calls.

     

  • Re: Re: create content with rest API's
    2012/09/02 14:16

    jahianewbie <p> i have no web application. I have a sandalone application which will ingest data. Here I will first need to use login call &amp; later create content call.</p> <p> I am wondering if there is a way where in I use only one call to create content. I can supply login credentials credentaials.&nbsp;</p> <p> I am trying to avoid 2 calls.</p> <p> &nbsp;</p>

  • Number of messages  2
    Registration date Sep 2, 2012
    0 (0 Good)
    0 (0 Bad)

    Re: Re: Re: create content with rest API's

    by  dsaulnier »  2012/10/15 09:27

    Hi,

    Any operation on some content (not only creation, but also modification, deletion, or even reading) needs a user account to be performed. If you use the built in API, it will use the user specified by your current session. That's why you have to login first, otherwise you will use an unauthenticated user, who has no write access on the content.
    As an alternative, you could implement a custom action, in order to extend the REST API. In your action, your can then call the JCR API to create some content, and not necessarily using the user specified by the request, you could create a jcr session for another user specified by some request parameters. Then, you would just need to call your action with a single request.


    Damien

    Damien Saulnier (dsaulnier)

    Number of messages  31
    Registration date
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page