cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1470
Views
0
Helpful
1
Replies

Has anyone had success using the HyperFlex API?

RedNectar
VIP Alumni
VIP Alumni

Hi Experts,

I had a long weekend, so thought I'd have a shot at checking out the HyperFlex API - the scant documentation and this early video does make it look pretty cool and easy to use, but alas I had no luck in getting it to work.

So I'm hoping someone will tell me why following the documentation doesn't work, and what secret undocumented step I'm missing.

SO here's the thing.

If i access, say https://<hx.ip.address>/restexplorer/#!/Datastore/getDatastores and click the Try it out! button, a little pop-up appears where I put in the username and password.

image.png

However, this is a waste of time! It does NOT matter whether I enter the correct password or not, or whether I use the admin user or a user defined in vCenter - the result is ALWAYS the same 401 - Access token invalid

image.png

BUT - the curious thing is, it DOES give me a nice curl command line that I can get to work by adding the username and password at the end. And a -k parameter to avoid the certificate error. And I did have to put my password inside single quotes.

admin:~$ curl -X GET --header 'Accept: application/json' 'https://hx.hx.hl.dns/rest/datastores' -u admin:'!@34QWer!@' -k
[{"entityRef":{"id":"00000000e4ee10d4:000000000001019b","type":"DATASTORE","name":"DS1","confignum":0,"setName":true,"setIdtype":false,"setConfignum":false,"setId":true,"setType":true},"stPlatDatastore":{"entityRef":{"id":"00000000e4ee10d4:000000000001019b","type":"DATASTORE","name":"DS1","confignum":
<snip>

So I began thinking about that -k option that I needed to make CURL work. And tried plan "B" - check out the AAA APIs.

https://hx.hx.hl.dns/aaa/restexplorer/index.html#!/Obtain32Access32Token/obtainAccessToken

In this scenario - the password is embodied in the request rather than having to enter the username and password in a pop-up.  AND IT WORKED!  201 - success

image.png

So can anyone tell me why why entering a password in the body of a request works, but NOT when entering it via a pop-up?

But back to my quest. Now that I have an access_token retuned by this API, I expected I'd be able to USE that token in other requests, like querying the datastores again - only this time adding the token as part of the request rather than relying on the pop-up, as explained in this tutorial on DevNet.

image.png

And all I got was MORE disappointment.

Sometimes I get the feeling that I'm simply documenting Cisco bugs (that no-one really cares about anyway - no bug-bounty scheme at Cisco....), but in this case I suspect it is a case of user error (i.e. ME) and one of you wonderful souls out there is going to tell me what I'm doing wrong.

TIA

RedNectar aka Chris Welsh.
Forum Tips: 1. Paste images inline - don't attach. 2. Always mark helpful and correct answers, it helps others find what they need.
1 Reply 1

gimar
Level 1
Level 1

Hello yes i was able to use the token.

Format:

Bearer [And your Token! 

Good luck!

Review Cisco Networking for a $25 gift card