Page 1 of 1

Creating a new user with webservices

Posted: Tue Nov 24, 2015 1:39 pm
by ithacash
I am attempting to create a user via the Cycle Communities web services api. What are the required JSON params to do so? I have read the docs but don't know how the UserRegistrationDTO should be represented with JSON.

POST https://communities.cyclos.org/[mycommu ... serService

User-Agent: curl
Host: communities.cyclos.org
Authorization: Basic <Base64 encoding of username:pwd>
Content-Type: application/json
Content-Length: 25

Code: Select all

{
     "operation": "register",
     "params": {
          ???
     }
}

Re: Creating a new user with webservices

Posted: Thu Dec 17, 2015 6:23 pm
by rmvanarkel
I would really recommend waiting for Cyclos 4.6, which will have a swagger REST implementation. If you really can't wait use something like the following code (but please understand that we can't give any additional support, because in a few months it will be much easier):

Step 1: request captcha

Url (post):
https://example.com/network/web-rpc/captchaService

Header:
None

Body:
{
"operation":"generate",
"params":[]
}

Next you get an id display the captcha that is generate in your page, e.g.:
https://example.com/network/content/cap ... 2071682440

Step 2: register user

Url (post):
https://example.com/network/web-rpc/userService

Header:
None

Body:
{
"operation":"publicRegister",
"params":[
{
"name":"Test User 09-21",
"email":"test09.21@mail.com",
"username":"testUser0921",
"group":{
"internalName":"name of group here"
},
"agreement":true,
"password":"12345678",
"confirmPassword":"12345678",
"mobilePhones":[
{
"name":"Mobile phone",
"hidden":true,
"rawNumber":"xxx"
}
],
"captchaId":"-2912315512071883144",
"captchaText":"bbpgy8",
"addresses":[
{
"name":"Address 1",
"addressLine1":"Address",
"zip":"3511AR",
"city":"Nederland"
}
],
"customValues":[
{
"field":{
"internalName":"gender"
},
"enumeratedValues":[
{
"internalName":"gender.man"
}
]
}
]
}
]
}

Succesfull response:
{
"result": {
"class": "org.cyclos.model.users.users.UserRegistrationResult",
"id": "-2912315512071768456",
"status": "EMAIL_VALIDATION",
"username": "testxUser0921"
}
}

Re: Creating a new user with webservices

Posted: Fri Dec 18, 2015 9:00 pm
by avf
It would be nice if the new REST was compatible with version 3.7 REST. It would be easier to upgrade.

Re: Creating a new user with webservices

Posted: Tue Jan 05, 2016 6:16 pm
by ithacash
rmvanarkel wrote:I would really recommend waiting for Cyclos 4.6, which will have a swagger REST implementation.
Do you have an ETA for this?

Re: Creating a new user with webservices

Posted: Mon Jan 25, 2016 10:01 am
by avf
Interested on ETA for 4.6 as well.