Unable to create new user using the HiveManager NG API

  • 2
  • Question
  • Updated 2 years ago
I have started testing the HiveManager NG API, following the documentation in the developer portal and using Postman. I have had success with getting information about users, changing information, renewing a credential and deleting a credential. However, creating a credential fails with status 400 and the message, 'IdentityServiceErrorCode.NO_POLICY'. One of the parameters to pass in the body of the request is 'policy' The documentation suggests this should be either 'Personal', or 'Guest'. I have tried both but get the same error. Anyone else had success with this, or can offer some advice?
Photo of Joseff Harris

Joseff Harris

  • 11 Posts
  • 0 Reply Likes

Posted 2 years ago

  • 2
Photo of Jonas Dekkers

Jonas Dekkers

  • 152 Posts
  • 29 Reply Likes
Maybe with capital letters? Following is working for me:
{"deliverMethod":"NO_DELIVERY",
          "policy":"PERSONAL",
          "groupId":"$group_id",
         
          "lastName":"$lastname",
          "organization":"$organisation_name",
          "purpose":"$purpose",
         

          "firstName":"$username"
        }
(Edited)
Photo of Joseff Harris

Joseff Harris

  • 11 Posts
  • 0 Reply Likes
Hi Jonas, thanks for you reply which was the key to me solving this.

You are right it needs to be in capitals. I had in fact tried in capitals before without success as my error was elsewhere in the request. I had extra, and unnecessary opening and closing brackets around my request. I think this meant none of the parameter values could be read but the first ,or only one being checked was the 'policy' parameter value, hence the error message I got. With my limited knowledge this lead me down the wrong path trying to find the solution.

As a note to Aerohive staff - in the API documentation the possible values for the parameter "policy" are given a few times and appear differently on these occasions. If you enter an incorrect value in a request then the error that comes back says this:

"code": "IdentityServiceErrorCode.BAD_POLICY",
"message": "Policy type is not supported. Supported policies include: Guest-Access and Personal-Access.",

which is misleading as these are not acceptable parameter values.

Now on to my next challenge which is to write an app for iOS devices allowing guests to request a PPSK.
Photo of Jonas Dekkers

Jonas Dekkers

  • 152 Posts
  • 29 Reply Likes
Hi Joseff, glad to help you! If you need more information just ask. I will try to help you (If I can :-D )
Photo of Joseff Harris

Joseff Harris

  • 11 Posts
  • 0 Reply Likes
Hi Jonas,

I wanted to use the HiveManager NG API in an app to run in kiosk mode on an iPad, This app would allow a visitor to request a PPSK for our wireless network. In the HiveManager NG help it states that an example iOS app is available in the developer portal for visitor access. I couldn't find this, and didn't get a response from Aerohive through the developer portal, so in the end though I should write one myself.

Thanks to your help getting me over my initial hurdle with the API I have now completed a basic iOS app to be used on an iPad in kiosk mode in our reception area to allow a visitor to request a PPSK for our wireless network.

The visitor enters their name on the screen, taps on a 'Submit' button, then the app using the API for HiveManager NG requests a credential, and the PPSK is displayed for the visitor.

The app is very much at the initial proof of concept stage and lacks elegance, proper error checking, and does not attempt to deal with issues such as when a user already has a credential and probably wants to renew it rather than request a new one, nor have the refinement of delivering the PPSK by SMS or email. However it works and I will continue to refine it. If it is of any interest to you as it is please let me know and I will upload it somewhere for you.

Joseff