Create new account with API request

RESTful knowledge exchange

Create new account with API request

Veeam Logoby sirinech » Thu Apr 10, 2014 9:15 am

I sent this request: http://localhost:9399/api/security/accounts
with the logon token and an xml file containing the necessary parameters just like it says in the API document provided by veeam : http://helpcenter.veeam.com/backup/70/rest/index.html

but I get the error code 500 internalServerError, I don't know why it's not working, can any one help me? the error response is the following:

Code: Select all
<?xml version="1.0" encoding="utf-8"?><Error StatusCode="500" Message="No characters can appear before the XML declaration. Line 2, position 2." xmlns="http://www.veeam.com/ent/v1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><FirstChanceExceptionMessage>No characters can appear before the XML declaration. Line 2, position 2.</FirstChanceExceptionMessage><StackTrace>Veeam.Backup.Interaction.RestAPI.CRestAPICommunicationException: No characters can appear before the XML declaration. Line 2, position 2. ---&gt; System.Xml.XmlException: No characters can appear before the XML declaration. Line 2, position 2.&#xD;
   at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)&#xD;
   at System.Xml.XmlUTF8TextReader.ReadDeclaration()&#xD;
   at System.Xml.XmlUTF8TextReader.Read()&#xD;
   at System.Xml.XmlBaseReader.MoveToContent()&#xD;
   at System.Xml.XmlBaseReader.IsStartElement()&#xD;
   at System.Xml.XmlBaseReader.IsStartElement(String localName, String namespaceUri)&#xD;
   at System.ServiceModel.Dispatcher.SingleBodyParameterMessageFormatter.ReadObject(Message message)&#xD;
   at System.ServiceModel.Dispatcher.SingleBodyParameterMessageFormatter.DeserializeRequest(Message message, Object[] parameters)&#xD;
   at System.ServiceModel.Dispatcher.UriTemplateDispatchFormatter.DeserializeRequest(Message message, Object[] parameters)&#xD;
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)&#xD;
   --- End of inner exception stack trace ---</StackTrace></Error>
sirinech
Influencer
 
Posts: 23
Liked: 1 time
Joined: Fri Mar 21, 2014 3:06 pm
Full Name: sirine chadly

Re: Create new account with API request

Veeam Logoby Vitaliy S. » Fri Apr 11, 2014 10:55 am

Hi Sirine,

Can you show us the XML file you're sending to the Web server? Also do you have a support ticket opened on this issue?

Thanks!
Vitaliy S.
Veeam Software
 
Posts: 19575
Liked: 1106 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

Re: Create new account with API request

Veeam Logoby sirinech » Fri Apr 18, 2014 4:30 pm

<?xml version="1.0" encoding="utf-8"?>
<EnterpriseAccountCreateSpec xmlns="http://www.veeam.com/ent/v1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<AccountType>Group</AccountType>
<AccountName>\SIRINE</AccountName>
<Roles>
<EnterpriseRole>
<EnterpriseRoleUid>urn:veeam:EnterpriseRole:5f37a46b-9ce2-40f4-8a62-b45b079257fc</EnterpriseRoleUid>
</EnterpriseRole>
</Roles>
<AllowRestoreAllVms>true</AllowRestoreAllVms>
<HierarchyScopeObjects>
<HierarchyScopeItem>
<HieararchyObjRef/>
<ObjectName/>
</HierarchyScopeItem>
</HierarchyScopeObjects>
</EnterpriseAccountCreateSpec>
sirinech
Influencer
 
Posts: 23
Liked: 1 time
Joined: Fri Mar 21, 2014 3:06 pm
Full Name: sirine chadly

Re: Create new account with API request

Veeam Logoby Vitaliy S. » Mon Apr 21, 2014 9:55 am

The XML looks valid, so I would open a support case and look how this API is called via WebEx session.
Vitaliy S.
Veeam Software
 
Posts: 19575
Liked: 1106 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov


Return to RESTful API



Who is online

Users browsing this forum: No registered users and 2 guests