2 Replies Latest reply: Aug 18, 2017 12:05 AM by matthias.schroeder RSS

Access to BlackBerry UEM Web Services failed with 401 Unauthorized

matthias.schroeder Newbie



we are currently developing a .NET Enterprise Application to access information from BlackBerry UEM 12.6. We were given the credentials of an AD user account with an assigned custom role containing only "View" rights. We followed the example from BWS-Samples/12.6/C#/Authentication sample at master · blackberry/BWS-Samples · GitHub to setup Authentication. Getting the authenticator (with Authentication Mode "AD") and the encoded username works fine. When sending our first request (getGroupsDetails) we get a 401 Unauthorized exception. We're setting up our request as follows:


     BWSService bwsService = new BWSService();
     bwsService.Url = "https://server:18084/enterprise/admin/ws";
     bwsService.Timeout = 30000;

     // Get authenticator ...

     // Get encoded username ...

     RequestMetadata requestMetadata = new RequestMetadata();
     requestMetadata.clientVersion = "12.6.0";
     requestMetadata.locale = "en-US";
     requestMetadata.organizationUid = "0";

     GetGroupsDetailRequest groupsRequest = new GetGroupsDetailRequest();
     groupsRequest.metadata = requestMetadata;
     groupsRequest.loadParentGroups = true;
     groupsRequest.loadChildGroups = true;
     groupsRequest.loadUsers = true;
     groupsRequest.loadITPolicies = true;
     groupsRequest.loadRoles = false;
     groupsRequest.loadSWConfigs = false;
     groupsRequest.loadVPNConfigs = false;
     groupsRequest.loadWLANConfigs = false;
     groupsRequest.loadEmailProfiles = false;
     groupsRequest.Applications = false;

     GetGroupsDetailResponse groupsResponse = new GetGroupsDetailResponse();
     groupsResponse = bwsService.getGroupsDetail(groupsRequest);
catch (Exception e)
     throw e;


So, where did we go wrong? Do we need additional rights for our user? Is it at all possible to access the service with a custom role containing only "View" rights?


Any help is greatly appreciated. Thanks in advance




  • Re: Access to BlackBerry UEM Web Services failed with 401 Unauthorized
    ebourne BlackBerry Employee

    I think you have a dash, and not an underscore on line 13.  ie: en_US NOT en-us.


    permissions of view are all you need.


    make sure and set the credentials on the service.  From the sample:


    string encodedUsername = getEncodedUserName(username, authenticator, credentialType, domain);

    if (!string.IsNullOrEmpty(encodedUsername))



                         * Set the HTTP basic authentication on the BWS service.

    * BWSUtilService is a utility web service that does not require

    * authentication.


    bwsService.Credentials = new NetworkCredential(encodedUsername, password);



                         * Send an HTTP Authorization header with requests after authentication

    * has taken place.


    bwsService.PreAuthenticate = true;

    returnValue = true;