RESTful knowledge exchange
Post Reply
monneq
Novice
Posts: 3
Liked: never
Joined: Dec 02, 2019 4:04 pm
Full Name: Monn Neq
Contact:

API [PUT] /cloud/tenant/{ID} - Object reference not set to an instance of an object

Post by monneq »

Case ID: #03891319

Hello,

I'm trying to update cloud tenant's password via REST api. I've tried many cases but i'm keep getting 500 error: "Object reference not set to an instance of an object".
I've tried sending params both in xml and json. I have no such problem while creating, deleting tenant etc. I would really appreciate if someone could show me example of working 'update tenant' request. Thanks.

Log from last try:

Code: Select all

[02.12.2019 10:13:09] <23> Info     [PUT] request to [http://XX.XX.XX.XX:9399/api/cloud/tenants/715e9079-4f84-4ce7-9636-a6471a471bc8] deserialized. Message: [... stream ...]; Parameters: [715e9079-4f84-4ce7-9636-a6471a471bc8], [Veeam.Backup.Interaction.RestAPI.Resources.CloudTenantEntityType].
[02.12.2019 10:13:09] <23> Info     [7c5acb9dc9eb4297887b24770024cac2] Retrieving CloudTenant
[02.12.2019 10:13:09] <23> Info     Sql query: [SELECT *, ROW_NUMBER() OVER (ORDER BY id) as RowNumber FROM [dbo].[Rest.CloudTenantsView] q1 WHERE q1.[id]=@Uid0], args: [@Uid0 = 715e9079-4f84-4ce7-9636-a6471a471bc8]
[02.12.2019 10:13:09] <23> Info     Sql proc: [[dbo].[usp.License.Agent.GetAgentLicenses]], args: []
[02.12.2019 10:13:09] <23> Info     Sql proc: [[dbo].[usp.License.Agent.GetAgentLicenses]], args: []
[02.12.2019 10:13:09] <23> Info     Sql query: [[dbo].[Licensing.CC.GetInstancesCountersInfoPerTenant]], args: [@platformTable = , @exclude_new_instances = True, @tenant_id = 715e9079-4f84-4ce7-9636-a6471a471bc8]
[02.12.2019 10:13:09] <23> Info     Sql query: [SELECT * FROM [Rest.CloudTenantResourcesView] tr WHERE tr.tenant_id=@ctenant_id], args: [@ctenant_id = 715e9079-4f84-4ce7-9636-a6471a471bc8]
[02.12.2019 10:13:09] <23> Info     Sql query: [SELECT * FROM [Rest.CloudTenantComputeResourcesView] tr WHERE tr.tenant_id=@ctenant_id], args: [@ctenant_id = 715e9079-4f84-4ce7-9636-a6471a471bc8]
[02.12.2019 10:13:09] <23> Info     Sql query: [SELECT cloud_gateway_pool_id FROM [C.TenantsCloudGatewayPools] WHERE tenant_id = @tenant_id], args: [@tenant_id = 715e9079-4f84-4ce7-9636-a6471a471bc8]
[02.12.2019 10:13:09] <23> Error    Failed to edit cloud tenant resource. Tenant: [715e9079-4f84-4ce7-9636-a6471a471bc8]. RequestUri: [http://XX.XX.XX.XX:9399/api/cloud/tenants/715e9079-4f84-4ce7-9636-a6471a471bc8].
[02.12.2019 10:13:09] <23> Error    Object reference not set to an instance of an object. (System.NullReferenceException)
[02.12.2019 10:13:09] <23> Error       at Veeam.Backup.Enterprise.RestAPIService.CRestTenantChecker.GetTenantType(CloudTenantEntityType entity)
[02.12.2019 10:13:09] <23> Error       at Veeam.Backup.Enterprise.RestAPIService.CRestTenantChecker.CheckVersionLatest(CloudTenantEntityType entity, CloudTenantEntityType oldEntity)
[02.12.2019 10:13:09] <23> Error       at Veeam.Backup.Enterprise.RestAPIService.CRestApiCloudTenantsScope.EditCloudTenant(String tenantIdStr, CloudTenantEntityType entity)
[02.12.2019 10:13:09] <23> Error       at Veeam.Backup.Enterprise.RestAPIService.CEnterpriseRestServiceStub.EditCloudTenant(String tenantIdOrName, CloudTenantEntityType entity)
[02.12.2019 10:13:09] <23> Error    Object reference not set to an instance of an object.
chris.arceneaux
VeeaMVP
Posts: 668
Liked: 359 times
Joined: Jun 24, 2019 1:39 pm
Full Name: Chris Arceneaux
Location: Georgia, USA
Contact:

Re: API [PUT] /cloud/tenant/{ID} - Object reference not set to an instance of an object

Post by chris.arceneaux »

Welcome to the Veeam forums Monn!

A sample xml payload can be found in Veeam documentation: (PUT) /cloud/tenants/{ID}

For your purposes, you can remove the Description item from the payload.

Image
monneq
Novice
Posts: 3
Liked: never
Joined: Dec 02, 2019 4:04 pm
Full Name: Monn Neq
Contact:

Re: API [PUT] /cloud/tenant/{ID} - Object reference not set to an instance of an object

Post by monneq »

Thanks for reply.
I'm sending requests in presented way but i'm keep getting 500 error: "Object reference not set to an instance of an object" anyway.
monneq
Novice
Posts: 3
Liked: never
Joined: Dec 02, 2019 4:04 pm
Full Name: Monn Neq
Contact:

Re: API [PUT] /cloud/tenant/{ID} - Object reference not set to an instance of an object

Post by monneq »

Request:

Code: Select all

http://XX.XX.XX.XX:9399/api/cloud/tenants/da1919fb-3b68-41a9-be9e-c85474e499dd

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<CloudTenant Type="CloudTenant" Href="http://XX.XX.XX.XX:9399/api/cloud/tenants/da1919fb-3b68-41a9-be9e-c85474e499dd?format=Entity" Name="6JiQA9frKRoHw4LJ" UID="urn:veeam:CloudTenant:da1919fb-3b68-41a9-be9e-c85474e499dd" 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">
<Description>xxx</Description>
</CloudTenant>
Response:

Code: Select all

<?xml version="1.0" encoding="utf-8"?><Error Message="Object reference not set to an instance of an object." StatusCode="500" 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>Object reference not set to an instance of an object.</FirstChanceExceptionMessage></Error>
API Log:

Code: Select all

[03.12.2019 03:32:47] <57> Info     [PUT] request to [http://XX.XX.XX.XX:9399/api/cloud/tenants/da1919fb-3b68-41a9-be9e-c85474e499dd] deserialized. Message: [<CloudTenant Type="CloudTenant" Href="http://XX.XX.XX.XX:9399/api/cloud/tenants/da1919fb-3b68-41a9-be9e-c85474e499dd?format=Entity" Name="6JiQA9frKRoHw4LJ" UID="urn:veeam:CloudTenant:da1919fb-3b68-41a9-be9e-c85474e499dd" 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">
[03.12.2019 03:32:47] <57> Info       <Description>xxx</Description>
[03.12.2019 03:32:47] <57> Info     </CloudTenant>]; Parameters: [da1919fb-3b68-41a9-be9e-c85474e499dd], [Veeam.Backup.Interaction.RestAPI.Resources.CloudTenantEntityType].
[03.12.2019 03:32:47] <57> Info     [22de5c63516a481db665da181916eec4] Retrieving CloudTenant
[03.12.2019 03:32:47] <57> Info     Sql query: [SELECT *, ROW_NUMBER() OVER (ORDER BY id) as RowNumber FROM [dbo].[Rest.CloudTenantsView] q1 WHERE q1.[id]=@Uid0], args: [@Uid0 = da1919fb-3b68-41a9-be9e-c85474e499dd]
[03.12.2019 03:32:47] <57> Info     Sql proc: [[dbo].[usp.License.Agent.GetAgentLicenses]], args: []
[03.12.2019 03:32:47] <57> Info     Sql proc: [[dbo].[usp.License.Agent.GetAgentLicenses]], args: []
[03.12.2019 03:32:47] <57> Info     Sql query: [[dbo].[Licensing.CC.GetInstancesCountersInfoPerTenant]], args: [@platformTable = , @exclude_new_instances = True, @tenant_id = da1919fb-3b68-41a9-be9e-c85474e499dd]
[03.12.2019 03:32:47] <57> Info     Sql query: [SELECT * FROM [Rest.CloudTenantResourcesView] tr WHERE tr.tenant_id=@ctenant_id], args: [@ctenant_id = da1919fb-3b68-41a9-be9e-c85474e499dd]
[03.12.2019 03:32:47] <57> Info     Sql query: [SELECT * FROM [Rest.CloudTenantComputeResourcesView] tr WHERE tr.tenant_id=@ctenant_id], args: [@ctenant_id = da1919fb-3b68-41a9-be9e-c85474e499dd]
[03.12.2019 03:32:47] <57> Info     Sql query: [SELECT cloud_gateway_pool_id FROM [C.TenantsCloudGatewayPools] WHERE tenant_id = @tenant_id], args: [@tenant_id = da1919fb-3b68-41a9-be9e-c85474e499dd]
[03.12.2019 03:32:47] <57> Error    Failed to edit cloud tenant resource. Tenant: [da1919fb-3b68-41a9-be9e-c85474e499dd]. RequestUri: [http://XX.XX.XX.XX:9399/api/cloud/tenants/da1919fb-3b68-41a9-be9e-c85474e499dd].
[03.12.2019 03:32:47] <57> Error    Object reference not set to an instance of an object. (System.NullReferenceException)
[03.12.2019 03:32:47] <57> Error       at Veeam.Backup.Enterprise.RestAPIService.CRestTenantChecker.GetTenantType(CloudTenantEntityType entity)
[03.12.2019 03:32:47] <57> Error       at Veeam.Backup.Enterprise.RestAPIService.CRestTenantChecker.CheckVersionLatest(CloudTenantEntityType entity, CloudTenantEntityType oldEntity)
[03.12.2019 03:32:47] <57> Error       at Veeam.Backup.Enterprise.RestAPIService.CRestApiCloudTenantsScope.EditCloudTenant(String tenantIdStr, CloudTenantEntityType entity)
[03.12.2019 03:32:47] <57> Error       at Veeam.Backup.Enterprise.RestAPIService.CEnterpriseRestServiceStub.EditCloudTenant(String tenantIdOrName, CloudTenantEntityType entity)
[03.12.2019 03:32:47] <57> Error    Object reference not set to an instance of an object.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests