REST API knowledge exchange
Post Reply
sirinech
Influencer
Posts: 23
Liked: 1 time
Joined: Mar 21, 2014 3:06 pm
Full Name: sirine chadly
Contact:

Create new account with API request

Post by sirinech »

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. ---> 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& rpc)&#xD;
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)&#xD;
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)&#xD;
   --- End of inner exception stack trace ---</StackTrace></Error>
Vitaliy S.
VP, Product Management
Posts: 27377
Liked: 2800 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: Create new account with API request

Post by Vitaliy S. »

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!
sirinech
Influencer
Posts: 23
Liked: 1 time
Joined: Mar 21, 2014 3:06 pm
Full Name: sirine chadly
Contact:

Re: Create new account with API request

Post by sirinech »

<?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>
Vitaliy S.
VP, Product Management
Posts: 27377
Liked: 2800 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: Create new account with API request

Post by Vitaliy S. »

The XML looks valid, so I would open a support case and look how this API is called via WebEx session.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests