HPE OneView
1748084 Members
5296 Online
108758 Solutions
New Discussion юеВ

Re: Oneview API Call fails for some REST queries

 
SOLVED
Go to solution
Craig Wilkinson
Occasional Advisor

Oneview API Call fails for some REST queries

I'm trying to get additional information via the Oneview integration with the UCMDB but any additional API calls I put in the mapping file seem to fail.

Using SOAPUI on a test system I can make some successful calls such as /rest/datacenters:

{
"type": "ErmResourceCollection",
"members": [ {
"width": 7200,
"depth": 3000,
"coolingCapacity": null,
"costPerKilowattHour": null,
"currency": "USD",
"deratingType": "NaJp",
"deratingPercentage": 20,
"coolingMultiplier": 1.5,
"contents": [],
"uri": "/rest/datacenters/afbb8bc7-403a-444b-948d-338707e957ed",
"defaultPowerLineVoltage": 220,
"uuid": "afbb8bc7-403a-444b-948d-338707e957ed",
"eTag": "2016-11-16T07:50:25.882Z",
"created": "2016-11-16T07:50:25.872Z",
"modified": "2016-11-16T07:50:25.882Z",
"status": "OK",
"name": "Datacenter 1",
"id": "afbb8bc7-403a-444b-948d-338707e957ed",
"state": "Unmanaged",
"category": "datacenters"
}],
"total": 1,
"count": 1,
"nextPageUri": null,
"start": 0,
"prevPageUri": null,
"category": "datacenters",
"eTag": null,
"created": "2016-11-17T09:36:27.839Z",
"modified": "2016-11-17T09:36:27.839Z",
"uri": "/rest/datacenters?start=0&count=1000"
}

But if I try something like managed sans (/rest/fc-sans/managed-sans) I get the same response:

{
"message": "Not Found.",
"recommendedActions": [],
"errorCode": null,
"details": null,
"errorSource": null,
"nestedErrors": [],
"data": {}
}

While there is no data, other calls which are in the OOTB integration but have no data (interconnects for example) don't produce an error and reply with a valid response stating there is no data.

{
"type": "InterconnectCollection",
"members": [],
"nextPageUri": null,
"start": 0,
"prevPageUri": null,
"total": 0,
"count": 0,
"created": null,
"eTag": null,
"modified": null,
"category": "interconnects",
"uri": "/rest/interconnects?start=0&count=0"
}

In the production environment with data populated we end up with the same results but it's not possible to show information from that environment due to it's sensitivity.

Is there anything obvious that's being done wrong to get further info from the APIs?

10 REPLIES 10
ChrisLynch
HPE Pro

Re: Oneview API Call fails for some REST queries

All except for the Managed SANs URI are successfully returning resource collections, and not API errors (you should see that you get an HTTP 200 response).  The Managed SANs query didn't produce a result, as it is dependant on a SAN Manager to be present, and should have returned an HTTP 404 response.  I really don't see anything wrong with what you are trying to do.


I am an HPE employee

Accept or Kudo

Craig Wilkinson
Occasional Advisor

Re: Oneview API Call fails for some REST queries

Unfortunately that's not the case, I get a 404 for calling /rest/fc-sans/managed-sans as follows:

HTTP/1.1 404 Not Found
Date: Fri, 18 Nov 2016 10:14:32 GMT
Server: Apache
X-Powered-By: ServiceStack/3.960 Unix/Mono
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Via: 1.1 example.com
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked

{"message":"Not Found.","recommendedActions":[],"errorCode":null,"details":null,"errorSource":null,"nestedErrors":[],"data":{}}

This is the response for /rest/interconnects:

HTTP/1.1 200 OK
Date: Fri, 18 Nov 2016 10:20:29 GMT
Server: Apache
Content-Type: application/json;charset=UTF-8
Via: 1.1 example.com
cache-control: no-cache
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked

{"type":"InterconnectCollection","members":[],"total":0,"nextPageUri":null,"start":0,"prevPageUri":null,"count":0,"category":"interconnects","created":null,"eTag":null,"modified":null,"uri":"/rest/interconnects?start=0&count=0"}

Craig Wilkinson
Occasional Advisor

Re: Oneview API Call fails for some REST queries

For further info, there are many calls that return a 404 too, for example /rest/storage-pools, /rest/storage-volumes, /rest/fc-sans/device-managers

Most of the ones I've tried that are not in the OOTB UCMDB adapter don't work and return a 404.

 

ChrisLynch
HPE Pro

Re: Oneview API Call fails for some REST queries

I will need to know some additional information to further help you.

  1. What version of HPE OneView are you running?
  2. Can you provide the entire REST API call, including all of the HTTP headers that you are submitting?

I cannot reproduce your results on either HPE OneView 2.00 (Patch 07) or HPE OneView 3.00.05 (RTM).  You are not supposed to get an HTTP 404 error when using a valid URI and the GET method.  So, a GET /rest/storage-pools will return an empty collection, not generate an HTTP 404 error.  You will recieve an HTTP 404 error when you attempt to use an invalid URI. 


I am an HPE employee

Accept or Kudo

Craig Wilkinson
Occasional Advisor

Re: Oneview API Call fails for some REST queries

For the test environment I'm using it's the download for Hyper-V 2.00.07, using /rest/version I get

{
"currentVersion": 201,
"minimumVersion": 1
}

I've attached a screenshot of running /rest/fc-sans/managed-sans which is using exactly the same as using /rest/interconnects (which works)

ChrisLynch
HPE Pro
Solution

Re: Oneview API Call fails for some REST queries

I see the attachment now.  Please know that HTTP Headers are critical to accessing endpoints.  If you are not passing the right HTTP headers, then you will get HTTP error codes on the return, instead of HTTP 200 with empty collections.

So, you need to add the following HTTP headers to your call:

ContentType = "application/json"
Accept = "application/json"
"X-API-Version" = 201
"accept-language" = "en_US"

I am an HPE employee

Accept or Kudo

Craig Wilkinson
Occasional Advisor

Re: Oneview API Call fails for some REST queries

Hi Chris

Thanks for the pointer, adding that in has helped with the SoapUI calls which now dont error and bring me back empty results (as I'd expect).

Odd that some calls work and some don't, but I can live with that.  Now I'll get to work modifying the OOTB UCMDB adapter so it works with all calls.

Cheers

Craig

ChrisLynch
HPE Pro

Re: Oneview API Call fails for some REST queries

If you have those headers present for all REST API (not SOAP) calls, then you should never see those HTTP 404 errors again.


I am an HPE employee

Accept or Kudo

Craig Wilkinson
Occasional Advisor

Re: Oneview API Call fails for some REST queries

I'm going to change the UCMDB OOTB adapter to do exactly that based on the version it returns initially, many thanks for the heads up.  I have found a vague reference to the X-API-Version in the docs now but without you pointing it out I'd never have figured this out.  But then again, that's the same for most of our product docs :D

Again, many thanks.