Jahia DX > REST and users

0 (0 Good)
0 (0 Bad)

REST and users

by  bonniny »  2012/01/05 14:31

Hello,

Is it possible to create users with the REST API from external source ?

  • REST and users
    2012/01/05 14:31

    bonniny <p> Hello,</p> <p> Is it possible to create users with the REST API from external source ?</p>

  • Number of messages  8
    Registration date Jan 5, 2012
    0 (0 Good)
    0 (0 Bad)

    Re: REST and users

    by  cflond »  2012/01/05 15:06

    Hi Yann,

    Yes you can. The easiest way is to call the userregistration action and to send the requested params to create the user.

    So you have to do a post on http://youservername:8080/cms/render/live/yourlang/sites/yoursitekey/home.newUser.do

    With at least these JSON params : username, password, confirm_password, desired_email, desired_firstname, desired_lastname

    You can specify any other user's param prefixed by j:

    For example to specify the birthday, send "j:birthDate", ...

    You can take the userregistration module (provided by default) as example. It is already using the rest API to create user.

    Feel free to ask if you need more details.

    Regards,

    Charles

     

     
  • Re: REST and users
    2012/01/05 15:06

    cflond <p> Hi Yann,</p> <p> Yes you can. The easiest way is to call the userregistration action and to send the requested params to create the user.</p> <p> So you have to do a post on http://youservername:8080/cms/render/live/yourlang/sites/yoursitekey/home.newUser.do</p> <p> With at least these JSON params :&nbsp;username,&nbsp;password,&nbsp;confirm_password,&nbsp;desired_email,&nbsp;desired_firstname,&nbsp;desired_lastname</p> <p> You can specify any other user&#39;s param prefixed by j:</p> <p> For example to specify the birthday, send<strong> </strong>&quot;j:birthDate&quot;, ...</p> <p> You can take the userregistration module (provided by default) as example. It is already using the rest API to create user.</p> <p> Feel free to ask if you need more details.</p> <p> Regards,</p> <p> Charles</p> <p> &nbsp;</p> <div> &nbsp;</div>

  • Number of messages  42
    Registration date Jan 5, 2012
    0 (0 Good)
    0 (0 Bad)

    Re: Re: REST and users

    by  bonniny »  2012/01/05 16:34

    Thks, it works after authentication.

    For information if the parameter "userredirectpage" is ommiting, the request gives a Null Pointer Exception due to line 121 in NewUser.java :

    return new ActionResult(HttpServletResponse.SC_ACCEPTED,parameters.get("userredirectpage").get(0), new JSONObject());

    Regards,

    Yann

  • Re: Re: REST and users
    2012/01/05 16:34

    bonniny <p> Thks, it works after authentication.</p> <p> For information if the parameter &quot;userredirectpage&quot; is ommiting, the request gives a Null Pointer Exception due to line 121 in NewUser.java :</p> <blockquote> <p> return new ActionResult(HttpServletResponse.SC_ACCEPTED,<em><strong>parameters.get(&quot;userredirectpage&quot;).get(0)</strong></em>, new JSONObject());</p> </blockquote> <p> Regards,</p> <p> Yann</p>

  • Number of messages  8
    Registration date Jan 5, 2012
    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