Python Jira - Issues: Assign Issue

Back to Index

Assigns the issue to the user. Use this resource to assign issues for the users having “Assign Issue” permission, and not having the “Edit Issue” permission. If name body parameter is set to “-1” then automatic issue assignee is used. A name set to null will remove the assignee. A successful response is indicated by a 204 status code with no response body. This example assigns issue "SCRUM-15" to "matt"

Documentation: https://developers.atlassian.com/cloud/jira/platform/rest/#api-api-2-issue-issueIdOrKey-assignee-put

CURL Command

curl -X PUT --user jira@example.com:JIRA_API_TOKEN \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '
    {
      "name": "matt"
    }' \
  --url 'https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-15/assignee'

Python Example

import sys
import chilkat

rest = chilkat.CkRest()

#  URL: https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-15/assignee
bTls = True
port = 443
bAutoReconnect = True
success = rest.Connect("your-domain.atlassian.net",port,bTls,bAutoReconnect)
if (success != True):
    print("ConnectFailReason: " + str(rest.get_ConnectFailReason()))
    print(rest.lastErrorText())
    sys.exit()

rest.SetAuthBasic("jira@example.com","JIRA_API_TOKEN")

json = chilkat.CkJsonObject()
json.UpdateString("name","matt")

rest.AddHeader("Content-Type","application/json")
rest.AddHeader("Accept","application/json")

sbRequestBody = chilkat.CkStringBuilder()
json.EmitSb(sbRequestBody)
sbResponseBody = chilkat.CkStringBuilder()
success = rest.FullRequestSb("PUT","/rest/api/2/issue/SCRUM-15/assignee",sbRequestBody,sbResponseBody)
if (success != True):
    print(rest.lastErrorText())
    sys.exit()

respStatusCode = rest.get_ResponseStatusCode()
if (respStatusCode >= 400):
    print("Response Status Code = " + str(respStatusCode))
    print("Response Header:")
    print(rest.responseHeader())
    print("Response Body:")
    print(sbResponseBody.getAsString())
    sys.exit()