Creating a new user with webservices

Any issue about Cyclos 4 scripting and Webservices

Moderators: hugo, alexandre, rmvanarkel

Post Reply
ithacash
Posts: 3
Joined: Tue Nov 24, 2015 10:18 am
Location: Ithaca, NY
Contact:

Creating a new user with webservices

Post 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": {
          ???
     }
}
---
Shane
Ithacash Sys/Web Dev
shane@ithacash.com
rmvanarkel
Posts: 245
Joined: Tue Oct 05, 2010 1:14 pm

Re: Creating a new user with webservices

Post 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"
}
}
avf
Posts: 23
Joined: Fri Sep 26, 2014 2:51 pm

Re: Creating a new user with webservices

Post by avf »

It would be nice if the new REST was compatible with version 3.7 REST. It would be easier to upgrade.
ithacash
Posts: 3
Joined: Tue Nov 24, 2015 10:18 am
Location: Ithaca, NY
Contact:

Re: Creating a new user with webservices

Post 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?
---
Shane
Ithacash Sys/Web Dev
shane@ithacash.com
avf
Posts: 23
Joined: Fri Sep 26, 2014 2:51 pm

Re: Creating a new user with webservices

Post by avf »

Interested on ETA for 4.6 as well.
Post Reply