Tcl Jira - Issues: Get Change Logs

Back to Index

Returns a paginated list of all updates of an issue, sorted by date, starting from the oldest. This example gets the change log for the issue with key = "SCRUM-15".

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

CURL Command

curl --user jira@example.com:JIRA_API_TOKEN \
 --header 'Accept: application/json' \
  --url 'https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-15/changelog'

Tcl Example


load ./chilkat.dll

set rest [new_CkRest]

#  URL: https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-15/changelog
set bTls 1
set port 443
set bAutoReconnect 1
set success [CkRest_Connect $rest "your-domain.atlassian.net" $port $bTls $bAutoReconnect]
if {[expr $success != 1]} then {
    puts "ConnectFailReason: [CkRest_ConnectFailReason $rest]"
    puts [CkRest_lastErrorText $rest]
    delete_CkRest $rest
    exit
}

CkRest_SetAuthBasic $rest "jira@example.com" "JIRA_API_TOKEN"

CkRest_AddHeader $rest "Accept" "application/json"

set sbResponseBody [new_CkStringBuilder]

set success [CkRest_FullRequestNoBodySb $rest "GET" "/rest/api/2/issue/SCRUM-15/changelog" $sbResponseBody]
if {[expr $success != 1]} then {
    puts [CkRest_lastErrorText $rest]
    delete_CkRest $rest
    delete_CkStringBuilder $sbResponseBody
    exit
}

set respStatusCode [CkRest_ResponseStatusCode $rest]
if {[expr $respStatusCode >= 400]} then {
    puts "Response Status Code = $respStatusCode"
    puts "Response Header:"
    puts [CkRest_responseHeader $rest]
    puts "Response Body:"
    puts [CkStringBuilder_getAsString $sbResponseBody]
    delete_CkRest $rest
    delete_CkStringBuilder $sbResponseBody
    exit
}

set jsonResponse [new_CkJsonObject]

CkJsonObject_LoadSb $jsonResponse $sbResponseBody

set self [CkJsonObject_stringOf $jsonResponse "self"]
set maxResults [CkJsonObject_IntOf $jsonResponse "maxResults"]
set startAt [CkJsonObject_IntOf $jsonResponse "startAt"]
set total [CkJsonObject_IntOf $jsonResponse "total"]
set isLast [CkJsonObject_BoolOf $jsonResponse "isLast"]
set i 0
set count_i [CkJsonObject_SizeOfArray $jsonResponse "values"]
while {[expr $i < $count_i]} {
    CkJsonObject_put_I $jsonResponse $i
    set id [CkJsonObject_stringOf $jsonResponse "values[i].id"]
    set authorSelf [CkJsonObject_stringOf $jsonResponse "values[i].author.self"]
    set authorName [CkJsonObject_stringOf $jsonResponse "values[i].author.name"]
    set authorKey [CkJsonObject_stringOf $jsonResponse "values[i].author.key"]
    set authorAccountId [CkJsonObject_stringOf $jsonResponse "values[i].author.accountId"]
    set authorEmailAddress [CkJsonObject_stringOf $jsonResponse "values[i].author.emailAddress"]
    set authorAvatarUrls48x48 [CkJsonObject_stringOf $jsonResponse "values[i].author.avatarUrls.48x48"]
    set authorAvatarUrls24x24 [CkJsonObject_stringOf $jsonResponse "values[i].author.avatarUrls.24x24"]
    set authorAvatarUrls16x16 [CkJsonObject_stringOf $jsonResponse "values[i].author.avatarUrls.16x16"]
    set authorAvatarUrls32x32 [CkJsonObject_stringOf $jsonResponse "values[i].author.avatarUrls.32x32"]
    set authorDisplayName [CkJsonObject_stringOf $jsonResponse "values[i].author.displayName"]
    set authorActive [CkJsonObject_BoolOf $jsonResponse "values[i].author.active"]
    set authorTimeZone [CkJsonObject_stringOf $jsonResponse "values[i].author.timeZone"]
    set created [CkJsonObject_stringOf $jsonResponse "values[i].created"]
    set historyMetadataType [CkJsonObject_stringOf $jsonResponse "values[i].historyMetadata.type"]
    set historyMetadataDescription [CkJsonObject_stringOf $jsonResponse "values[i].historyMetadata.description"]
    set historyMetadataDescriptionKey [CkJsonObject_stringOf $jsonResponse "values[i].historyMetadata.descriptionKey"]
    set historyMetadataActivityDescription [CkJsonObject_stringOf $jsonResponse "values[i].historyMetadata.activityDescription"]
    set historyMetadataActivityDescriptionKey [CkJsonObject_stringOf $jsonResponse "values[i].historyMetadata.activityDescriptionKey"]
    set historyMetadataActorId [CkJsonObject_stringOf $jsonResponse "values[i].historyMetadata.actor.id"]
    set historyMetadataActorDisplayName [CkJsonObject_stringOf $jsonResponse "values[i].historyMetadata.actor.displayName"]
    set historyMetadataActorType [CkJsonObject_stringOf $jsonResponse "values[i].historyMetadata.actor.type"]
    set historyMetadataActorAvatarUrl [CkJsonObject_stringOf $jsonResponse "values[i].historyMetadata.actor.avatarUrl"]
    set historyMetadataActorUrl [CkJsonObject_stringOf $jsonResponse "values[i].historyMetadata.actor.url"]
    set historyMetadataGeneratorId [CkJsonObject_stringOf $jsonResponse "values[i].historyMetadata.generator.id"]
    set historyMetadataGeneratorType [CkJsonObject_stringOf $jsonResponse "values[i].historyMetadata.generator.type"]
    set historyMetadataCauseId [CkJsonObject_stringOf $jsonResponse "values[i].historyMetadata.cause.id"]
    set historyMetadataCauseType [CkJsonObject_stringOf $jsonResponse "values[i].historyMetadata.cause.type"]
    set historyMetadataExtraDataKeyvalue [CkJsonObject_stringOf $jsonResponse "values[i].historyMetadata.extraData.keyvalue"]
    set historyMetadataExtraDataGoes [CkJsonObject_stringOf $jsonResponse "values[i].historyMetadata.extraData.goes"]
    set j 0
    set count_j [CkJsonObject_SizeOfArray $jsonResponse "values[i].items"]
    while {[expr $j < $count_j]} {
        CkJsonObject_put_J $jsonResponse $j
        set field [CkJsonObject_stringOf $jsonResponse "values[i].items[j].field"]
        set fieldtype [CkJsonObject_stringOf $jsonResponse "values[i].items[j].fieldtype"]
        set from [CkJsonObject_stringOf $jsonResponse "values[i].items[j].from"]
        set fromString [CkJsonObject_stringOf $jsonResponse "values[i].items[j].fromString"]
        set v_to [CkJsonObject_stringOf $jsonResponse "values[i].items[j].to"]
        set toString [CkJsonObject_stringOf $jsonResponse "values[i].items[j].toString"]
        set fieldId [CkJsonObject_stringOf $jsonResponse "values[i].items[j].fieldId"]
        set j [expr $j + 1]
    }
    set i [expr $i + 1]
}

delete_CkRest $rest
delete_CkStringBuilder $sbResponseBody
delete_CkJsonObject $jsonResponse

Sample JSON Response Body

{
  "self": "https://chilkat.atlassian.net/rest/api/2/issue/SCRUM-15/changelog?maxResults=100&startAt=0",
  "maxResults": 100,
  "startAt": 0,
  "total": 7,
  "isLast": true,
  "values": [
    {
      "id": "10009",
      "author": {
        "self": "https://chilkat.atlassian.net/rest/api/2/user?username=admin",
        "name": "admin",
        "key": "admin",
        "accountId": "557058:be8b47b5-3bc0-43f6-b6b2-2cca0de12204",
        "emailAddress": "admin@@chilkatsoft.com",
        "avatarUrls": {
          "48x48": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=48&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D48%26noRedirect%3Dtrue",
          "24x24": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=24&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D24%26noRedirect%3Dtrue",
          "16x16": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=16&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D16%26noRedirect%3Dtrue",
          "32x32": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D32%26noRedirect%3Dtrue"
        },
        "displayName": "Chilkat Admin",
        "active": true,
        "timeZone": "America/Chicago"
      },
      "created": "2018-04-05T14:41:55.852-0500",
      "items": [
        {
          "field": "status",
          "fieldtype": "jira",
          "from": "10000",
          "fromString": "To Do",
          "to": "3",
          "toString": "In Progress"
        }
      ]
    },
    {
      "id": "10010",
      "author": {
        "self": "https://chilkat.atlassian.net/rest/api/2/user?username=admin",
        "name": "admin",
        "key": "admin",
        "accountId": "557058:be8b47b5-3bc0-43f6-b6b2-2cca0de12204",
        "emailAddress": "admin@@chilkatsoft.com",
        "avatarUrls": {
          "48x48": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=48&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D48%26noRedirect%3Dtrue",
          "24x24": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=24&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D24%26noRedirect%3Dtrue",
          "16x16": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=16&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D16%26noRedirect%3Dtrue",
          "32x32": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D32%26noRedirect%3Dtrue"
        },
        "displayName": "Chilkat Admin",
        "active": true,
        "timeZone": "America/Chicago"
      },
      "created": "2018-04-08T00:33:55.852-0500",
      "items": [
        {
          "field": "status",
          "fieldtype": "jira",
          "from": "3",
          "fromString": "In Progress",
          "to": "10001",
          "toString": "Done"
        }
      ]
    },
    {
      "id": "10033",
      "author": {
        "self": "https://chilkat.atlassian.net/rest/api/2/user?username=admin",
        "name": "admin",
        "key": "admin",
        "accountId": "557058:be8b47b5-3bc0-43f6-b6b2-2cca0de12204",
        "emailAddress": "admin@@chilkatsoft.com",
        "avatarUrls": {
          "48x48": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=48&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D48%26noRedirect%3Dtrue",
          "24x24": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=24&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D24%26noRedirect%3Dtrue",
          "16x16": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=16&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D16%26noRedirect%3Dtrue",
          "32x32": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D32%26noRedirect%3Dtrue"
        },
        "displayName": "Chilkat Admin",
        "active": true,
        "timeZone": "America/Chicago"
      },
      "created": "2018-04-12T20:07:08.107-0500",
      "items": [
        {
          "field": "assignee",
          "fieldtype": "jira",
          "fieldId": "assignee",
          "from": null,
          "fromString": null,
          "to": "matt",
          "toString": "Matt of Chilkat"
        }
      ]
    },
    {
      "id": "10035",
      "author": {
        "self": "https://chilkat.atlassian.net/rest/api/2/user?username=admin",
        "name": "admin",
        "key": "admin",
        "accountId": "557058:be8b47b5-3bc0-43f6-b6b2-2cca0de12204",
        "emailAddress": "admin@@chilkatsoft.com",
        "avatarUrls": {
          "48x48": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=48&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D48%26noRedirect%3Dtrue",
          "24x24": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=24&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D24%26noRedirect%3Dtrue",
          "16x16": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=16&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D16%26noRedirect%3Dtrue",
          "32x32": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D32%26noRedirect%3Dtrue"
        },
        "displayName": "Chilkat Admin",
        "active": true,
        "timeZone": "America/Chicago"
      },
      "created": "2018-04-13T08:07:40.815-0500",
      "items": [
        {
          "field": "summary",
          "fieldtype": "jira",
          "fieldId": "summary",
          "from": null,
          "fromString": "As a scrum master, I can see the progress of a sprint via the Burndown Chart >> Click \"Reports\" to view the Burndown Chart",
          "to": null,
          "toString": "Bug in business logic"
        },
        {
          "field": "labels",
          "fieldtype": "jira",
          "fieldId": "labels",
          "from": null,
          "fromString": "",
          "to": null,
          "toString": "triaged"
        }
      ],
      "historyMetadata": {
        "type": "myplugin:type",
        "description": "text description",
        "descriptionKey": "plugin.changereason.i18.key",
        "activityDescription": "text description",
        "activityDescriptionKey": "plugin.activity.i18.key",
        "actor": {
          "id": "tony",
          "displayName": "Tony",
          "type": "mysystem-user",
          "avatarUrl": "http://mysystem/avatar/tony.jpg",
          "url": "http://mysystem/users/tony"
        },
        "generator": {
          "id": "mysystem-1",
          "type": "mysystem-application"
        },
        "cause": {
          "id": "myevent",
          "type": "mysystem-event"
        },
        "extraData": {
          "keyvalue": "extra data",
          "goes": "here"
        }
      }
    },
    {
      "id": "10036",
      "author": {
        "self": "https://chilkat.atlassian.net/rest/api/2/user?username=admin",
        "name": "admin",
        "key": "admin",
        "accountId": "557058:be8b47b5-3bc0-43f6-b6b2-2cca0de12204",
        "emailAddress": "admin@@chilkatsoft.com",
        "avatarUrls": {
          "48x48": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=48&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D48%26noRedirect%3Dtrue",
          "24x24": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=24&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D24%26noRedirect%3Dtrue",
          "16x16": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=16&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D16%26noRedirect%3Dtrue",
          "32x32": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D32%26noRedirect%3Dtrue"
        },
        "displayName": "Chilkat Admin",
        "active": true,
        "timeZone": "America/Chicago"
      },
      "created": "2018-04-13T09:11:35.151-0500",
      "items": [
        {
          "field": "assignee",
          "fieldtype": "jira",
          "fieldId": "assignee",
          "from": "matt",
          "fromString": "Matt of Chilkat",
          "to": "admin",
          "toString": "Chilkat Admin"
        }
      ]
    },
    {
      "id": "10037",
      "author": {
        "self": "https://chilkat.atlassian.net/rest/api/2/user?username=admin",
        "name": "admin",
        "key": "admin",
        "accountId": "557058:be8b47b5-3bc0-43f6-b6b2-2cca0de12204",
        "emailAddress": "admin@@chilkatsoft.com",
        "avatarUrls": {
          "48x48": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=48&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D48%26noRedirect%3Dtrue",
          "24x24": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=24&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D24%26noRedirect%3Dtrue",
          "16x16": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=16&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D16%26noRedirect%3Dtrue",
          "32x32": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D32%26noRedirect%3Dtrue"
        },
        "displayName": "Chilkat Admin",
        "active": true,
        "timeZone": "America/Chicago"
      },
      "created": "2018-04-13T10:04:19.046-0500",
      "items": [
        {
          "field": "Attachment",
          "fieldtype": "jira",
          "fieldId": "attachment",
          "from": null,
          "fromString": null,
          "to": "10000",
          "toString": "starfish.jpg"
        }
      ]
    },
    {
      "id": "10038",
      "author": {
        "self": "https://chilkat.atlassian.net/rest/api/2/user?username=admin",
        "name": "admin",
        "key": "admin",
        "accountId": "557058:be8b47b5-3bc0-43f6-b6b2-2cca0de12204",
        "emailAddress": "admin@@chilkatsoft.com",
        "avatarUrls": {
          "48x48": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=48&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D48%26noRedirect%3Dtrue",
          "24x24": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=24&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D24%26noRedirect%3Dtrue",
          "16x16": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=16&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D16%26noRedirect%3Dtrue",
          "32x32": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D32%26noRedirect%3Dtrue"
        },
        "displayName": "Chilkat Admin",
        "active": true,
        "timeZone": "America/Chicago"
      },
      "created": "2018-04-13T10:04:46.939-0500",
      "items": [
        {
          "field": "Attachment",
          "fieldtype": "jira",
          "fieldId": "attachment",
          "from": null,
          "fromString": null,
          "to": "10001",
          "toString": "starfish.jpg"
        },
        {
          "field": "Attachment",
          "fieldtype": "jira",
          "fieldId": "attachment",
          "from": null,
          "fromString": null,
          "to": "10002",
          "toString": "sample2.docx"
        },
        {
          "field": "Attachment",
          "fieldtype": "jira",
          "fieldId": "attachment",
          "from": null,
          "fromString": null,
          "to": "10003",
          "toString": "sample.pdf"
        }
      ]
    }
  ]
}