Created
March 8, 2013 17:44
-
-
Save kastork/5118301 to your computer and use it in GitHub Desktop.
Add a Liferay user via JSON Web Service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab(group='com.github.groovy-wslite', module='groovy-wslite', version='0.7.2') | |
import wslite.rest.* | |
import wslite.http.auth.* | |
println "This is the add user script" | |
def client = new RESTClient("http://localhost:8080/api/jsonws/") | |
client.authorization = new HTTPBasicAuthorization("test@liferay.com", "test") | |
client.httpClient.sslTrustAllCerts = true | |
def myQuery = [ | |
companyId: '10154', | |
autoPassword:'true', | |
password1:'', | |
password2:'', | |
autoScreenName:'true', | |
screenName:'', | |
emailAddress:'testy@example.com', | |
facebookId:'0', | |
openId:'', | |
locale:'en', | |
firstName:'Testy', | |
middleName:'the', | |
lastName:'Tester', | |
prefixId:'0', | |
suffixId:'0', | |
male:'true', | |
birthdayMonth:'0', | |
birthdayDay:'1', | |
birthdayYear:'1970', | |
jobTitle:'', | |
groupIds:'', | |
organizationIds:'', | |
roleIds:'', | |
userGroupIds:'', | |
sendEmail:'false' | |
] | |
println "" | |
def response = client.post( path:'user/add-user') { | |
urlenc myQuery | |
} | |
println "" | |
println response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment