@neounix: Thanks very much for your reply. It stopped my wild goose chase. I was thinking the reason I was getting the unauthorized response was because of an authentication issue.
Turns out, you’re right, there’s no API key required for this action. Rather, it was a (simple) code error, which is clear from the code I posted above, but that I had missed before (I was incorrectly putting in the variable for the AJAX url).
Here’s the working code:
var groupName = [RELEVANT GROUP NAME]
var token = [TOKEN I GENERATED]
$.ajax({
url: 'https://myforum.com/groups/' + groupName + '.json', //this is where the old error was
contentType: "application/json",
dataType: 'json',
success: function(result){
console.log('full response = ' + JSON.stringify(result));
console.log('is group owner = ' + result.group.is_group_owner); //note this will either be true or null
}
})
I was getting the unauthorized response before, because the prior URL I was entering had the incorrect group name (it was being read as “groupName”).