VBScript 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'

VBScript Example

Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set outFile = fso.CreateTextFile("output.txt", True)

set rest = CreateObject("Chilkat_9_5_0.Rest")

'  URL: https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-15/assignee
bTls = 1
port = 443
bAutoReconnect = 1
success = rest.Connect("your-domain.atlassian.net",port,bTls,bAutoReconnect)
If (success <> 1) Then
    outFile.WriteLine("ConnectFailReason: " & rest.ConnectFailReason)
End If

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

set json = CreateObject("Chilkat_9_5_0.JsonObject")
success = json.UpdateString("name","matt")

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

set sbRequestBody = CreateObject("Chilkat_9_5_0.StringBuilder")
success = json.EmitSb(sbRequestBody)
set sbResponseBody = CreateObject("Chilkat_9_5_0.StringBuilder")
success = rest.FullRequestSb("PUT","/rest/api/2/issue/SCRUM-15/assignee",sbRequestBody,sbResponseBody)
If (success <> 1) Then
End If

respStatusCode = rest.ResponseStatusCode
If (respStatusCode >= 400) Then
    outFile.WriteLine("Response Status Code = " & respStatusCode)
    outFile.WriteLine("Response Header:")
    outFile.WriteLine("Response Body:")
End If