Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zimbra-admin-api-js
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Public
zimbra-admin-api-js
Commits
7ce1d28f
Commit
7ce1d28f
authored
Apr 19, 2016
by
Patricio Bruna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added more examples for creating a resource
parent
b4f6bac5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
3 deletions
+34
-3
README.md
README.md
+34
-3
No files found.
README.md
View file @
7ce1d28f
...
...
@@ -162,8 +162,41 @@ The methods are:
*
`createDomain('domain_name', zimbra_attributes, callback)`
,
*
`createDistributionList('email_address', zimbra_attributes, callback)`
#### Examples
##### 1. Create an account
Always have to pass an
`email_address`
and a
`password`
:
```
javascript
var
zimbra_attributes
=
{};
zimbraApi
.
createAccount
(
'user1@example.com'
,
'SuP3rS3cur3P4ss'
,
zimbra_attributes
,
callback
);
// Account {name: "user1@example.com", id: "1919c856-08cc-43c9-b927-0c4cf88f50c7", attrs: Object}
```
We are making
`zimbra_attributes`
and empty object, because we are not passing any attributes.
If everything goes OK you get the created Object as a result.
##### 2. Create an account with a invalid Email Address
Check the
*space*
between
`user`
and
`1@example.com`
```
javascript
var
zimbra_attributes
=
{};
zimbraApi
.
createAccount
(
'user 1@example.com'
,
'SuP3rS3cur3P4ss'
,
zimbra_attributes
,
callback
);
// Error {status: 500, title: "Internal Server Error", extra: Object}
// Error.extra {
// code: "service.INVALID_REQUEST",
// reason: "invalid request: invalid email address"
// }
```
You get an
`Error`
Object with the reason of the failure.
##### 3. Create an Account with some attributes
`zimbra_attributes`
must be an
`Object`
, that can be empty, that should have valid Zimbra attributes
for the
`Resource`
being created. For example, lets create an
`Account`
with:
for the
`Resource`
being created.
In this example we are creating an account with the following attributes:
*
First Name (
`givenName`
),
*
Last Name (
`sn`
), and
...
...
@@ -178,5 +211,3 @@ var zimbra_attributes = {
zimbraApi
.
createAccount
(
'user@example.com'
,
'SuP3rS3cur3P4ss'
,
zimbra_attributes
,
callback
);
// Account {name: "user@customer.dev", id: "1919c856-08cc-43c9-b927-0c4cf88f50c7", attrs: Object}
```
All the functions returns the created resource
`Object`
.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment