flycastpartnersinc / FreshservicePS

Powershell Module to interface with Freshworks Freshservice REST API.
MIT License
21 stars 4 forks source link

Get-FSRequesterGroupMember.ps1 returns a list of Requester Groups and not a list of Group Members #15

Open CoryInIT opened 9 months ago

CoryInIT commented 9 months ago

When calling Get-FSRequesterGroupMember it is returning a list of Requester Groups, and not the membership in the group specified in the function parameter i.e. Get-FSRequesterGroupMember -id '2000009XXXX' -Verbose

Expected Behavior

The function should return an object containing the list of members of the group specified in the request.

Current Behavior

The function returns an object which contains the list of requester groups.

Possible Solution

Verify that the appropriate URL is being constructed in the module Get-FreshServiceRequesterGroupMember.ps1 There appears to be inconsistency in lines 72 & 73 as to which variable is referenced. (<- Don't know that this is the cause, but I just noticed the inconsistency, IANAP).

Verbose output does not show the requester group ID nor the appended "/members" url path required by the API: VERBOSE: Invoke-FreshworksRestMethod - Initiating REST API call to https://company.freshservice.com/api/v2/requester_groups?page=1&per_page=100 VERBOSE: Invoke-FreshworksRestMethod - Uri: https://company.freshservice.com/api/v2/requester_groups?page=1&per_page=100

I would expect the URI to contain: https://company.freshservice.com/api/v2/requester_groups/2000009XXXX/members?page=1&per_page=100

Steps to Reproduce (for bugs)

  1. Create a Freshservice API Connection using "New-FreshServiceConnection"
  2. Connect to the connection using "Connect-Freshservice"
  3. Make the function call using a known group ID, "Get-FSRequesterGroupMember -id '2000009XXXX' -Verbose"
  4. Observe the output, a list of all requester groups.

Context

I'm trying to get a current list of the requester group members to synchronize them with an Active Directory group.

Your Environment

Module version: 0.1.6 Powershell version: PSVersion 5.1.19041.3031 Windows 10.0.19044

rasimmers commented 9 months ago

Confirmed this is a bug. There is an if statement that was failing and /members were not appended. Updated If statement for next release.

dkpham81 commented 6 months ago

Get-FreshServiceRequesterGroupMember.ps1 Line 72 Should be: if ($id) { instead of if ($requester_group_id) {