Start a new topic
Answered

User group discoverability

I have created new user group via the REST api but there seems to be no tool to list existing groups. If I forget the group id how do I ever find it? Is there any way to see the groups in console?


Thanks



Best Answer

Hi,


You can use Business Logic to get the list of groups. I created a custom endpoint with following code and I was able to return the list of groups.

  

function onRequest(request, response, modules) {
  var collectionAccess = modules.collectionAccess;
  var TransCollection = collectionAccess.collection('group');
  var logger = modules.logger;

  TransCollection.find( {}, {},
    function(err, groups) {
      if (err){
        logger.error('Query failed: '+ err); 
	      response.error(err);
      }else{
        logger.info(groups);
        response.body = groups;
        response.complete(200);
      }
  });
}

 


As I said earlier in reply to one of your other forum posts, user groups cannot be created using Kinvey web console. Actually, no actions related to Group API can be taken from web console or Kinvey SDKs. Group API is supported only through REST interface. I would recommend implementing a custom solution for user groups without using Kinvey user groups. That is only if your application has a genuine requirement for such a use case.


Regards,

Wani

Kinvey Support


thanks!

Answer

Hi,


You can use Business Logic to get the list of groups. I created a custom endpoint with following code and I was able to return the list of groups.

  

function onRequest(request, response, modules) {
  var collectionAccess = modules.collectionAccess;
  var TransCollection = collectionAccess.collection('group');
  var logger = modules.logger;

  TransCollection.find( {}, {},
    function(err, groups) {
      if (err){
        logger.error('Query failed: '+ err); 
	      response.error(err);
      }else{
        logger.info(groups);
        response.body = groups;
        response.complete(200);
      }
  });
}

 


As I said earlier in reply to one of your other forum posts, user groups cannot be created using Kinvey web console. Actually, no actions related to Group API can be taken from web console or Kinvey SDKs. Group API is supported only through REST interface. I would recommend implementing a custom solution for user groups without using Kinvey user groups. That is only if your application has a genuine requirement for such a use case.


Regards,

Wani

Kinvey Support

Login or Signup to post a comment