import members
API Support | Available since | Last updated | Output |
---|---|---|---|
6.0000 | 6.0000 | json, xml |
Description
Imports members into PageSeeder using comma-separated (CSV) data.
Parameters
Name | Description | Required | Type | Default value |
---|---|---|---|---|
createpersonal | Whether to create a personal group for each member | no | boolean | false |
data | The members to be imported in CSV format | yes | string |
createpersonal
When set to true
, this parameter creates a personal group for each member. This includes members created by the import as well as existing members.
When the personal group has been created for a member, the output includes the "personalGroupCreated": true
JSON property or personal-group-created="true"
attribute.
If you need to create the personal groups for a list of users, you can use this service and only specify their email or username and the createpersonal parameter set to true
since the other fields are ignored. For example:
_,_,user@example.org
data
The data
parameter uses comma separated values as:
[firstname],[surname],[email],[username?],[password?]
The first three fields are always required. The password is also required for new members.
For example:
Guy,Adams,guy.adams@example.org,guyadams,passW0rd_For_M3mb3r! Jess,Bridges,jess.bridges@example.org,jessbridges,pa55word-F0r-M3mb3r Drew,Patterson,drew.patterson@example.org,drewpatterson,pa$$Word{For}MEMBER
All member fields restrictions apply:
- firstname and surname must be between 1 and 50 characters;
- username must be less than 100 characters and can have letters, numbers, ‘.’, ‘_’, ‘-’ but can’t be all numbers;
- email must be less than 100 characters and a valid email address.
If the user has no email, this must be set explicitly by setting the email address to “No email” or "null" and the username must be specified, for example:
Dale,Bryant,No Email,dalebryant,passW0rd_For_M3mb3r! Kasey,Becker,null,kaseybecker,pA55word_f0R-M3mb3r...
The import uses the email address to match with existing users, and falls back on the username if the user has no email. Both the email address and username must be unique.
If a value contains a comma, it should be wrapped by double quotes. For example:
"Maria, Alejandra",Alvarado,ma.alvarado@example.org,,PA$$word(for)M3M83R
It is not possible to include a line delimiter in a value, line delimiters are automatically interpreted as a separate member.
Permission
This service requires Administrator.
Response
The returned XML is as follows:
<members-import> <import firstname="[first name]" surname="[surname]" email="[email]" username="[username]" status="[created|existing|error]" [id="[member id]"] [personal-group-created="true"] [error=""] /> ... </members-import>
or in JSON:
{ "imports": [{ "firstname": string, "surname": string, "email": string, "username": string, "status": string, "id": number, "personalGroupCreated": boolean, "error": string }, ...] }
Sample created
If a user does not already exist, the returned status is created
and the returned details included the ID of the member. If the createpersonal parameter is set to true
, the response also includes the personalGroupCreated
flag.
{ "imports":[{ "firstname": "Marlin", "surname": "Adams", "email": "marlin.adams@example.org", "username": "marlinadams", "status": "created", "id": 74778, "personalGroupCreated": true }] }
Sample existing
If a user already exists, the existing details are returned instead of the original details sent in the request, and it returns status="existing"
. If the createpersonal parameter is set to true
, the response also includes the personalGroupCreated
flag.
The details sent in the import data do NOT overwrite the existing data.
{ "imports": [{ "firstname": "Maria", "surname": "Adams", "email": "maria.adams@example.org", "username": "mariaadams", "status": "existing", "id": 59064 }] }
Error Handling
When an error occurs, this service returns a 200 HTTP status code, but includes information about the error in the response.
If the data is incomplete or the email or username is invalid, it returns status="error"
for that member. For example:
{ "imports": [{ "firstname": "", "surname": "Smith", "email": "somebody@example.org", "username": "", "status": "error", "error": "The firstname is required" }] }