In the following it is assumed that:
- curl is the reference tool for CLI invocation
admin:password
are the credentials for accessing Syncope core- Syncope core runs on http://localhost:9080/syncope
Apache Syncope >= 2.0.X
Details are available in the Reference Guide.
Info |
---|
With Apache Syncope 2.0.0, besides using curl as with earlier versions, a brand new CLI tool is available. |
Tip |
---|
For more details please refer to the REST API reference, which is also available at http://localhost:9080/syncope/. |
Tip |
---|
If selected for deployment, the Swagger extension is also available at http://localhost:9080/syncope/swagger/. |
Apache Syncope 1.2.X
Tip |
---|
For more details please refer to the REST API reference, which is also available at http://localhost:9080/syncope/rest/doc/. |
Create user
Code Block |
---|
curl -X POST -u admin:password -H "Accept: application/json" -H "Content-Type: application/json"\
--data @/tmp/newuser.json |
Create a user
To create a user with the REST-interface using curl on the command line:
Panel |
---|
curl -u admin:password -H "Content-Type: application/json" --data @/tmp/newuser http://localhost:9080/syncope/rest/ user/create.jsonImage Removed |
Where:
where /tmp/newuser
...
The file /tmp/newuser could look like this.json
looks like:
Code Block |
---|
|
{
{ "id": 0,
"idpassword": "0password123",
"username": "myusernamemyusername@apache.org",
"passwordsecurityQuestion": null,
"test123securityAnswer": null,
"attributes" : [
{
"schema": "fullname",
"readonly": false,
{"values": [
"myusername@apache.org"
]
},
{
"schema": "userIdloginDate",
"readonly": false,
"values": [
"2015-11-12"
]
} "values
]
} |
To link the user to an existing resource, include this in the root json hash:
Code Block |
---|
|
"resources": [
"ws-target-resource-1"
]
|
You might want to add
Panel |
---|
-H "Prefer: return-no-content" |
to avoid Syncope core populating the HTTP response with the created user entry.
Update user
Code Block |
---|
curl -X POST -u admin:password -H "Accept: application/json" -H "Content-Type: application/json"\
--data @/tmp/updateuser.json http://localhost:9080/syncope/rest/users/100 |
where 100 is the id of the user to be deleted and /tmp/updateuser.json
looks like:
Code Block |
---|
|
{
"id": 100,
"username": "newUsername",
"password": "updatedPassword",
"attributesToRemove": [
"surname"
],
"attributesToUpdate": [
{
"schema": "surname","example1@example.com"]
},
{
"valuesToBeAdded": [
"New surname"
],
"valuesToBeRemoved": []
}
]
} |
You might want to add
Panel |
---|
-H "Prefer: return-no-content" |
to avoid Syncope core populating the HTTP response with the updated user entry.
Delete user
Code Block |
---|
curl -X DELETE -u admin:password -H "Accept: application/json" http://localhost:9080/syncope/rest/users/100 |
where 100 is the id of the user to be deleted.
You might want to add
Panel |
---|
-H "Prefer: return-no-content" |
to avoid Syncope core populating the HTTP response with the deleted user entry.
Export database content
Code Block |
---|
curl -X GET -u admin:password -o content.xml http://localhost:9080/syncope/rest/configurations/stream |
Change configuration parameter value
Code Block |
---|
curl -X PUT -u admin:password -H "Accept: application/json" -H "Content-Type: application/json" \
-d '{"schema":"selfRegistration.allowed","values":["true"]}' http://localhost:9080/syncope/rest/configurations/selfRegistration.allowed |
Apache Syncope <= 1.1.X
Create user
Code Block |
---|
curl -u admin:password -H "Content-Type: application/json" --data @/tmp/newuser.json http://localhost:9080/syncope/rest/user/create.json |
where /tmp/newuser.json
looks like:
Code Block |
---|
|
{
"id": "0",
"username": "myusername",
"password": "test123",
"attributes": [
"surname",
{
"schema": "userId",
"values": ["My Surname"
"example1@example.com"
]
},
{
"schema": "surname",
"values": }
[
"My Surname"
]
}
]
}
|
To link the user to an existing resource, include this in the root json hash:
Code Block |
---|
|
"resources" : [
"ws-target-resource-1"
]
|
Export database content
Panelcode |
---|
curl -u admin:password -o content.xml -H "Content-Type: application/xml" -X GET http://localhost:9080/syncope/ restcxf/ configurationconfigurations/ dbexportImage Removedstream |
Change configuration parameter value
Panelcode |
---|
curl -u admin:password -H "Content-Type: application/json" \
-d '{"key":"smtp.host","value":"smtp.ngi.it"}' http://localhost:9080/syncope/rest/configuration/update.json Image Removed |