REST API knowledge exchange
			
		
		
			
				
																			
								Mardock 							 
						Influencer 			
		Posts:  23Liked:  never Joined:  Jul 10, 2014 3:40 pm
				Contact: 
				
			 
				
		 
		
						
					
																		
							
						
									
						Post 
					 
								by Mardock  Jul 25, 2014 8:02 am 
				
			
			
			
			Hi,
I'm trying to edit credentials description. I make HTTP PUT request but the server response is 500 internal server error.
This is my example request:
Code: Select all 
Request:
PUT http://<Enterprise-Manager>:9399/api/backupServers/{ID_bckupServer}/credentials/{ID_credentials}
Request Header:
X-RestSvcSessionId NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj
Request Body:
<?xml version="1.0" encoding="utf-8"?>
<CredentialsInfo Href="http://localhost:9399/api/backupServers/f62624c1-8462-4747-8bd4-d686f35b0540/credentials/9a8fb453-cacd-4089-a97e-437e99f128bc" Type="Credentials" 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">
	<Id>9a8fb453-cacd-4089-a97e-437e99f128bc</Id>
	<Description>Edited via RESTful API</Description>
</CredentialsInfo>
Response:
500 Internal server error.
Thank you,
Mardock.
 
		 
				
		
		 
	 
				
		
		
			
				
																			
								poulpreben 							 
						Certified Trainer 			
		Posts:  1028Liked:  448 times Joined:  Jul 23, 2012 8:16 amFull Name:  Preben Berg
				Contact: 
				
			 
				
		 
		
						
					
																		
							
						
									
						Post 
					 
								by poulpreben  Jul 25, 2014 8:05 am 
				
			
			
			
			Hi Mardock,
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								veremin 							 
						Product Manager 			
		Posts:  20736Liked:  2403 times Joined:  Oct 26, 2012 3:28 pmFull Name:  Vladimir Eremin
				Contact: 
				
			 
				
		 
		
						
					
																		
							
						
									
						Post 
					 
								by veremin  Jul 25, 2014 8:28 am 
				
			
			
			
			As far as I'm aware, it should be PUT method. I've just edited the credentials, using the following body request, and everything seems to have worked properly. So, feel free to try it:
Code: Select all 
<?xml version="1.0" encoding="utf-8"?>
<CredentialsInfo Type="Credentials" Href="http://localhost:9399/api/backupServers/{ID}/credentials/{ID}" 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">
  <Id>{ID}</Id>
  <Username>{NAME}</Username>
  <Description>Edited via RestAPI</Description>
  <Password/>
</CredentialsInfo>
Thanks.
 
		 
				
		
		 
	 
				
		
		
			
				
																			
								poulpreben 							 
						Certified Trainer 			
		Posts:  1028Liked:  448 times Joined:  Jul 23, 2012 8:16 amFull Name:  Preben Berg
				Contact: 
				
			 
				
		 
		
						
					
																		
							
						
									
						Post 
					 
								by poulpreben  Jul 25, 2014 8:35 am 
				
			
			
			
			You are right. It also works without <Username> and <Password/> tags as OP suggested:
Code: Select all 
<?xml version="1.0" ?>
<CredentialsInfo Href="http://10.0.0.5:9399/api/backupServers/25fa85fe-df49-42f5-b289-f1b2fd69961c/credentials/5968272a-3c63-409d-ae3c-fe013794df93" Type="Credentials" xmlns="http://www.veeam.com/ent/v1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<Id>5968272a-3c63-409d-ae3c-fe013794df93</Id>
	<Description>no user, no pass</Description>
</CredentialsInfo>
 
		 
				
		
		 
	 
				
		
		
			
				
																			
								Mardock 							 
						Influencer 			
		Posts:  23Liked:  never Joined:  Jul 10, 2014 3:40 pm
				Contact: 
				
			 
				
		 
		
						
					
																		
							
						
									
						Post 
					 
								by Mardock  Jul 25, 2014 10:14 am 
				
			
			
			
			Hi,
The request doesn't work yet...
If I sniff the HTTP traffic I get in the body of response the following error :
Code: Select all 
Unable to deserialize XML body with root name 'CredentialsInfo' and root namespace 'http://www.veem.com/ent/v1.0' (for operation 'EditCredentials' and contract ('IEnterpriseRestService',  'http://www.veeam.com/ent/v1.0')) using XmlSerializer. Ensure that the type corresponding to the XML is added to the known types collection of the service.
Thank you very much,
Mardock.
 
		 
				
		
		 
	 
				
				
		
		
			
				
																			
								Mardock 							 
						Influencer 			
		Posts:  23Liked:  never Joined:  Jul 10, 2014 3:40 pm
				Contact: 
				
			 
				
		 
		
						
					
																		
							
						
									
						Post 
					 
								by Mardock  Jul 25, 2014 10:35 am 
				
			
			
			
			Yes, in my request headers there are:
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
		
			
				
																			
								veremin 							 
						Product Manager 			
		Posts:  20736Liked:  2403 times Joined:  Oct 26, 2012 3:28 pmFull Name:  Vladimir Eremin
				Contact: 
				
			 
				
		 
		
						
					
																			
						
									
						Post 
					 
								by veremin  Jul 28, 2014 9:51 am 
				
			
			
			
			
			
			
									
						
										
						 
		 
				
		
		 
	 
	
	
	
		
		Users browsing this forum: No registered users and 1 guest