Have been working on some vRA APIs for Reservation creation. I am trying to see all business groups and compute resources using these urls
https://$host/identity/api/tenants/qe/subtenants
Keep running into issues with output
{
"errors": [
{
"code": 10108,
"message": "Invalid data access API use.",
"systemMessage": "HTTP/1.1 401 Unauthorized : ",
"moreInfoUrl": null
}
]
}
I have all Tenant Admin, Infra Admin, and Fabric Admin access. Anyone using Reservation API ?
From the inventory view inside vRO are you able to see all the reservations listed with all the properties?
I have exactly the same problem here.
Calling to /identity/api/tenants/{tenantId}/subtenants works correctly, but calling to /reservation-service/api/reservations throws this error:
{
"errors": [
{
"code": 10108,
"message": "Invalid data access API use.",
"moreInfoUrl": null
}
]
}
In vRO, I can see reservations correctly in "vCAC Infrastructure Administration -> Host -> Reservations".
In vRA appliance, catalina.out shows:
2016-01-20 16:35:46,364 vcac: [component="cafe:reservation-service" priority="WARN" thread="tomcat-http--6" tenant="vsphere.local"] org.springframework.web.client.RestTemplate.handleResponseError:581 - GET request for "https://vraHost/iaas-proxy-provider/api/services/4d1904a0-52fb-4e50-926f-4e73da24f98e/reservations/?..." resulted in 400 (Bad Request); invoking error handler
2016-01-20 16:35:46,365 vcac: [component="cafe:reservation-service" priority="ERROR" thread="tomcat-http--6" tenant="vsphere.local"] com.vmware.vcac.platform.rest.client.error.ResponseErrorHandler.handleError:55 - [Rest Error]: {Status code: 400}, {Error code: 10108} , {Error Source: null}, {Error Msg: Invalid data access API use.}, {System Msg: null}
2016-01-20 16:35:46,366 vcac: [component="cafe:reservation-service" priority="ERROR" thread="tomcat-http--6" tenant="vsphere.local"] com.vmware.vcac.core.reservation.repository.gateway.ReservationRepositoryGateway.findAll:170 - Exception while retrieving reservations from provider with serviceTypeId: [com.vmware.csp.iaas.blueprint.service][Rest Error]: {Status code: 400}, {Error code: 10108} , {Error Source: null}, {Error Msg: Invalid data access API use.}, {System Msg: null}
(full error stack attached)
Despite this, in vRA portal I can see the reservations using the same credentials. Is like the api-proxy is the problem but I don't know what to do.
Any ideas?
Thanks a lot!
D.
I ran into these problems initially, the root cause in my case was invalid Bearer token. Also the header's content should be '{}', along with inParams is null. I hope that you have include the correct token in the header. Here is part of my code:
var restContent = '{}'; | |
var inParamtersValues = []; |
var addRESTOperation = restHost.addOperation(restOp); | |
var req = addRESTOperation.createRequest(inParamtersValues, restContent); | |
req.contentType = "application/json"; |
// Add Bearer token for authentication | |
var authorizationToken = "Bearer " + token | |
req.setHeader("Accept", "application/json"); | |
req.setHeader("Authorization", authorizationToken); |
Sadly is not case. The token is ok because it works with non Reservation Api calls.
In all cases, restarting the IaaS database was the way to make it back to work. But of course this is not the solution of the problem.
So the question is, why restarting the IaaS database makes this work again and why the API calls doesn't work when the console screens still working.
D.
At the time the API calls were generating 400 bad requests, was the IaaS-Service showing up as registered in the 5480 VAMI page?
Any resolution to this? I'm experiencing the same problem when trying to view all reservations: https://$vrahost/reservatio-service/api/reservations. Issue is this used to work until I tried to update a reservation via vRO. Now I can't get any reservations to show up via API calls. I can see the reservations in the vRO inventory tree and via the vRA portal, just not via the REST API calls. Yes the IaaS-Service has a status of registered. If I restart the vRA services everything comes up fine.
I actually found my problem. When making the REST call (PUT method) I didn't have the content-type header set. As a result, vRA interpreted the JSON body as invalid data and the reservation-service api became unusable. Restarting vRA services and setting the correct header type worked.