Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set-JiraUser with Property parameter fails with error 'Invoke-JiraMethod : No value found to be changed.' #508

Open
jschlackman opened this issue Apr 4, 2024 · 1 comment · May be fixed by #509

Comments

@jschlackman
Copy link

jschlackman commented Apr 4, 2024

Description

When using the Set-JiraUser cmdlet with the -Property parameter to set properties not named in the cmdlet (e.g. updating the user's login name), the command fails with the following output:

Invoke-JiraMethod : No value found to be changed.
At C:\Program Files\WindowsPowerShell\Modules\JiraPS\2.14.7\JiraPS.psm1:5876 char:27
+                 $result = Invoke-JiraMethod @parameter
+                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidResult: (:) [Invoke-JiraMethod], RuntimeException
    + FullyQualifiedErrorId : InvalidResponse.Status400,Invoke-JiraMethod

Steps To Reproduce

  1. Connect to Jira server using Set-JiraConfigServer and New-JiraSession as per normal
  2. Execute the following:
Set-JiraUser -User "bsmith" -Property @{Name="csmith"}
  1. Observe error

Expected behavior

Username for user bsmith should be changed to csmith

Workaround

In the same environment, crafting the REST body manually and calling Invoke-JiraMethod with the correct Uri per the below example produces the expected behavior:

$putUri = "https://jira.contoso.com/rest/api/2/user?username=bsmith"
$putBody = "{""name"": ""csmith""}"
Invoke-JiraMethod -URI $putUri -Body $changeBody -Method Put

(Note: URL of Jira server has been changed for privacy)

Your Environment

Jira Server Version: 9.12.2

Name                      Version
----                      -------
JiraPS                    2.14.7 
PSVersion                        
PSEdition                        
PSCompatibleVersions             
BuildVersion                     
CLRVersion                       
WSManStackVersion                
PSRemotingProtocolVersion        
SerializationVersion    
@jschlackman
Copy link
Author

jschlackman commented Apr 5, 2024

Update: this appears to actually be a documentation issue. I realized after revisiting my workaround that passing @{Name="csmith"} in the -Property parameter will fail but @{name="csmith"} succeeds. It appears the user property names passed to the API are case sensitive (which is not specified in the official REST API docs) and do not match the capitalization used in the JiraPS outout objects or the example code given in the JiraPS documentation.

jschlackman added a commit to jschlackman/JiraPS that referenced this issue Apr 5, 2024
Added note to the Property parameter regarding accepted capitalization of user property names. Fixes AtlassianPS#508.
@jschlackman jschlackman linked a pull request Apr 5, 2024 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant