Nalla Srinivas
Nalla Srinivas

Reputation: 933

zimbra user account creation using SOAP/REST

I want to create a Zimbra account when ever user signup in my application. is there any SOAP/REST calls for doing this job in Zimbra.

Please let me know if there are any other ways.

Upvotes: 2

Views: 8301

Answers (3)

humkins
humkins

Reputation: 10705

You asked about any other ways. There is one more way, from command line on zimbra server.

zmprov ca [email protected] somepassword

If you can run your app on the same box where zimra is running then you can use this interface.

Upvotes: 0

Greg S
Greg S

Reputation: 544

I needed to create accounts and domains in my NodeJS app, so I implemented a small nodeJS library (zimbra-client) https://github.com/grishick/zimbra-client for that.

Example of creating an account:

zimbra = require("zimbra-client");
zimbra.getAuthToken("localhost", "admin", "test123",
    function(err, authToken) {
        if(err != null) {
            console.log(err.message);
        }
        zimbra.createAccount("localhost",{sn:"Solovyev",givenName:"Greg",displayName:"Greg Solovyev",password:"test123",name:"[email protected]"},authToken,
            function(err1,accountObj) {
                if(err1 != null) {
                    if(err1.code == "account.ACCOUNT_EXISTS") {
                        console.log("an account with this name already exists");
                    } else {
                        console.log(err1.message);
                    }
                } else {
                    console.log("new account ID" + accountObj.id);
                }
            }
        );
    })

Upvotes: 1

Nab Ilovich
Nab Ilovich

Reputation: 360

A SOAP account creation request should look like that :

<CreateAccountRequest name="{account-name}" password="{account-password}"> ## CreateAccountRequest
    (<a n="{key}" /> ## Attr)*
</CreateAccountRequest>

name contains the full Zimbra account name : [email protected].

If you don't specifiy a password, the user won't be able to log in. (The password can be set later anyways).

a tag allows you to send some optionals attributes.

Example :

<CreateAccountRequest xmlns="urn:zimbraAdmin">
    <name>[email protected]</name>
    <password>foobar</password>
    <a n="givenName">John</a>
    <a n="sn">Doe</a>
    <a n="displayName">John Doe</a>
    <a n="zimbraCOSId">The CoS id comes here.</a>
</CreateAccountRequest>

Documentation : Zimbra SOAP requests

Upvotes: 1

Related Questions