cancel
Showing results for 
Search instead for 
Did you mean: 

Help on accessing HiveManager NG on premise API

Help on accessing HiveManager NG on premise API

wies_hays
New Contributor III

Hello,

 

I need some help on accessing the HiveManager NG API.

 

First I generated an access token for "client-id: myClient".... which is XXX_YYYmyClient

 

How can I talk to the API now?

 

I tried:

curl -v -X GET --noproxy myhivemanger.my.domain -k -H 'X-AH-API-CLIENT-SECRET: XXX__YYYmyClient' -H 'X-AH-API-CLIENT-ID: myClient' -H 'X-AH-API-CLIENT-REDIRECT-URI: https://myhivemanager.my.domain' https://myhivemanager.my.domain/xapi/v1/monitor/devices

 

but it's returning:

 

{"data":null,"error":{"status":400,"code":"GatewayErrorCode.ACCESS_TOKEN_MISSING","message":"Calls must include Authorization header with a valid Bearer access token.","rawMessage":"moPLiqZNJB","errorParams":null,"validationErrors":null,"moreInfo":null}}

 

What am I doing wrong?

5 REPLIES 5

aprice
New Contributor

Good timing. That's a good answer from David.

wies_hays
New Contributor III

Hi Alan,

 

thank you so much for your reply. Yes, this is still an open topic for me.

I will look into this soon and give feedback here.

 

I also found this new post here:

https://thehivecommunity.aerohive.com/s/question/0D50c00005kwJoRCAU/are-the-instructions-on-the-aerohive-developer-site-for-setting-up-api-connections-the-same-for-both-cloud-and-on-prem-instances?language=en_US

Look for David's post.

 

Thank you!

 

Best regards,

Armin

 

aprice
New Contributor

Hi Armin.

I happened to find this post while looking for something else about the API. I think you're missing your Bearer token. I'm using Postman for my development, so pardon any missing pieces since I don't use curl much. Keith is right that you need the ownerID, too.

 

I think you need an extra Authorization header like this:

-H 'Authorization: Bearer <your_token>'

 

It took me a while to figure out where all of this was found, and a couple messages in the API support chat. The Bearer token is the secret that you generate within HiveManager by providing the Client ID from the API portal. The Client Secret and Client ID are both direct from the API portal. The redirect URL is up to you; we have it set to our HM's FQDN because we're not using OAuth. In Postman I'm sending four headers with each request.

 

Hope this helps!

(If you didn't already figure it out.)

 

Alan

wies_hays
New Contributor III

Do you mean

curl -v -X GET --noproxy myhivemanger.my.domain -k -H 'X-AH-API-CLIENT-SECRET: XXX__YYYmyClient' -H 'X-AH-API-CLIENT-ID: myClient' -H 'X-AH-API-CLIENT-REDIRECT-URI: https://myhivemanager.my.domain' https://myhivemanager.my.domain/xapi/v1/monitor/devices?ownerId=2 ?

 

Still the same error.

 

Apart from the link above, which is no help if you don't know the cloud solution... where is the API documentation for the "on premise" Hivemanager NG?

 

Thank you!

GTM-P2G8KFN