|
Version: 7C
HC7 Build: 7.00.0012 and later
API Build: 1.00.0001 and later
User Manager - AddUser creates a user with given details. This web service call can be made as http://your-domain.com/HC7API/UserManager.asmx?op=AddUser.
Input Parameters
HostUserName
HostPassword
OwnerName - user name under which you want to create new user
PlanName - plan name to be sold at user creation time
NewUserName - name of the user to be created
NewUserPassword - password of the user to be created
EmailAddress - email address of the user to be created
OptionalParam
WebServerName - if sent, user will be created
on specified server otherwise loadbalancing will be
done
ResellerType
EnableAutoBilling - sent if you want to enable auto billing for this user
SendInvoices - sent if you want to send invoices to this user
CountryName - Country name of the user
StateName - State name of the user
WebsiteName - required for ftpuser creation, for setting permissions
Language
Output Parameters
N/A
Sample Optional Parameters
<Parameters>
<Parameter Name = "WebServerName">abc</Parameter>
<Parameter Name = "ResellerType">Dedicated</Parameter>
<Parameter Name = "EnableAutoBillinng">True</Parameter>
<Parameter Name = "SendInvoices">False</Parameter>
<Parameter Name = "CountryName">United States</Parameter>
<Parameter Name = "StateName">Albama</Parameter>
<Parameter Name = "WebsiteName">MyDomain.com</Parameter>
<Parameter Name = "Language">French</Parameter>
</Parameters>
Sample SOAP Request
POST /HC7API/UserManager.asmx HTTP/1.1 Host: your-domain.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://tempuri.org/AddUser" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd= "http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <AddUser xmlns="http://tempuri.org/"> <HostUserName>host</HostUserName> <HostPassword>host123</HostPassword> <OwnerName>david</OwnerName> <PlanName>Basic Plan</PlanName> <NewUserName>john</NewUserName> <NewUserPassword>johnnew</NewUserPassword> <EmailAddress>john@hosting.net</EmailAddress> <OptionalParam>xml</OptionalParam> </AddUser> </soap:Body> </soap:Envelope>
Sample HTTP Request
POST /HC7API/UserManager.asmx/AddUser HTTP/1.1 Host: your-domain.com Content-Type: application/x-www-form-urlencoded Content-Length: length HostUserName=host&HostPassword=host123&OwnerName=david&PlanName=BasicPlan& NewUserName=john&NewUserPassword=johnnew&EmailAddress=john@hosting.net&OptionalParam=xml
Sample C# Code
public UserManager.Response AddUser(string strHostUserName, string strHostPassword, string strOwnerName, string strPlanName, string strNewUserName, string strNewUserPassword, string strEmailAddress) { try { UserManager.UserManager oUser = new UserManager.UserManager(); UserManager.Response oResponse = new UserManager.Response(); XmlDocument oDoc = new XmlDocument(); //Adding root node XmlNode xOptionalParam = oDoc.CreateNode(XmlNodeType.Element,"Parameters",""); //Adding sub nodes XmlNode xParameter = oDoc.CreateNode(XmlNodeType.Element,"Parameter",""); XmlAttribute xAttribute = oDoc.CreateAttribute("Name"); xAttribute.Value = "WebServerName"; xParameter.Attributes.Append(xAttribute); xParameter.InnerText = "abc"; xOptionalParam.AppendChild(xParameter); ....... ....... ....... oResponse = oUser.AddUser(strHostUserName, strHostPassword, strOwnerName, strPlanName, strNewUserName, strNewUserPassword, strEmailAddress, OptionalParam); } catch { } return oRespose; }
Sample Response
<Response> <Method>AddUser</Method> <Status>true</Status> <ErrorCode>70500001</ErrorCode> <ErrorDescription>User added successfully.</ErrorDescription> <Result/> </Response>