Skip to content

Removing assignees from jira tickets is awkward #177

@rianjs

Description

@rianjs
Bash(jtk issues update MON-4231 --field customfield_10035=2)                                                       
  ⎿  ✓ Updated issue MON-4231                      
                                                                                                                     
⏺ Bash(jtk issues update MON-4231 --field assignee=null)                                                           
  ⎿  Error: Exit code 1                                                                                              
     updating issue MON-4231: bad request: assignee: Specify a valid value for assignee                              
                                                                                                                     
⏺ Bash(jtk issues update MON-4231 --no-assignee 2>&1 || jtk issues update MON-4231 --field 'assignee=""' 2>&1)       
  ⎿  Error: Exit code 1                                                                                              
     unknown flag: --no-assignee                                                                                     
     updating issue MON-4231: bad request: assignee: Specify a valid value for assignee                              
                                                                                                                     
⏺ Bash(jtk issues update MON-4231 --assignee "null" 2>&1)                                                            
  ⎿  Error: Exit code 1                                            
     updating issue MON-4231: bad request: assignee: Specify a valid value for assignee                              
                                                                                                                   
⏺ Bash(curl -s -X PUT \                                                                                              
        -H "Authorization: Basic $(echo -n "$JIRA_EMAIL:$JIRA_API_TOKEN" | base64)" \…)                              
  ⎿  {                                                                                                               
       "errorMessages": [                                                                                            
         "Issue does not exist or you do not have permission to see it."                                             
     … +3 lines (ctrl+o to expand) 

Then I asked what it did calling the API directly:

⏺ Yes, jtk doesn't support setting assignee to null/empty — every variation I tried (--field assignee=null,          
  --assignee "null", --field 'assignee=""', --no-assignee) failed with "Specify a valid value for assignee."
                                                                                                                     
  So I fell back to a direct Jira REST API call:   
                                                                                                                     
  curl -s -X PUT \                                                             
    -H "Authorization: Basic $(echo -n "rian@monitapp.io:$JIRA_API_TOKEN" | base64)" \
    -H "Content-Type: application/json" \          
    -d '{"fields":{"assignee":null}}' \       
    "https://monitproduct.atlassian.net/rest/api/3/issue/MON-4231"             
                                               
  The Jira REST API accepts null for assignee natively — it's a jtk CLI limitation. Worth noting: my first curl
  attempt also failed because JIRA_EMAIL wasn't set as an env var (it's only in the jtk config file), so I had to
  hardcode the email from jtk config show.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions