REpresentational State Transfer
En fait, tout est REST1) et se fait surtout en ligne de commande a? l'aide de curl.
D'apre?s un ancien tutoriel2), voici quelques commandes (non teste?es ! mais il faudra ajouter le
referer si Server Protection Service est active?) :
# create a user
| Bloc de code |
|---|
curl -F:name=zach -Fpwd=secret -FpwdConfirm=secret \
http://admin:admin@localhost:8080/system/userManager/user.create.html
|
# create a group (a group's name must start with 'g-')
| Bloc de code |
|---|
curl \-F:name=g-developers \
http://admin:admin@localhost:8080/system/userManager/group.create.html
|
# put the user in a group
| Bloc de code |
|---|
curl \-F:member=/system/userManager/user/zach \
http://admin:admin@localhost:8080/system/userManager/group/g-developers.updat
e.html
|
# create site
| Bloc de code |
|---|
curl -F"sakai:title=Fun With Sakai" -F"sling:resourceType=sakai/site" \
\-F"sakai:authorizables=g-developers" \
http://admin:admin@localhost:8080/sites/fun_with_sakai
|
# request the members of the site
| Bloc de code |
|---|
curl http://localhost:8080/sites/fun_with_sakai.members.json
|
Plus re?cent (et teste?), script de cre?ation de compte pour l'utilisateur Paul, Create-Paul.sh 3) :
| Bloc de code |
|---|
\#\!/bin/sh
(curl \-d
"pwd=local_password&pwdConfirm=local_password&firstName=Paul&lastName=Erdos&:
name=paul&:sakai:profile-import={\"basic\": {\"elements\":
{\"firstName\":{\"value\": \"Paul\"}, \"lastName\": {\"value\": \"Erdos\"},
\"email\": {\"value\":\"erdos@example.edu\"}, \"college\": {\"value\":
\"Institute for Advanced Study\"}}}}" \
\--referer http://localhost:8080/dev/test.html \
http://admin:admin@localhost:8080/system/userManager/user.create.html \
>/dev/null 2>/dev/null \
&& echo Created paul ) \
\|\| echo ERROR creating paul
|