Ionic HTTP API - get device token for user


#1

Hi, I have been trying for the last couple of days to figure out how can I extract the device token for a specific subset of users.
This is what I have so far. All I am getting as response is a list of all the users device tokens. I want to be able to pass a fixed amount of user_id’s and get those specific device tokens. Any ideas?

var options = {
        method: 'GET',
        url: 'https://api.ionic.io/push/tokens',
        headers: {
            'Content-Type': 'application/json',
            'Authorization': 'Bearer ' + token
        },
        data: {
            'user_id': userId, //email
            'show_invalid': showInvalid, //true
            'page_size': pageSize, //1
            'page': page //1
            
        }
    };

    reqApi(options, function(err, response, body) {
      if (err) throw new Error(err);
      else{
        for (var i = 0; i< data.length; i++){
            sendPush("Title", "Details", data[i].token);
        }
        
      }
    });