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

Swift Example


func chilkatTest() {
    let rest = CkoRest()
    var success: Bool

    //  URL: https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-15/changelog
    var bTls: Bool = true
    var port: Int = 443
    var bAutoReconnect: Bool = true
    success = rest.Connect("your-domain.atlassian.net", port: port, tls: bTls, autoReconnect: bAutoReconnect)
    if success != true {
        print("ConnectFailReason: \(rest.ConnectFailReason.intValue)")
        print("\(rest.LastErrorText)")
        return
    }

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

    rest.AddHeader("Accept", value: "application/json")

    let sbResponseBody = CkoStringBuilder()
    success = rest.FullRequestNoBodySb("GET", uriPath: "/rest/api/2/issue/SCRUM-15/changelog", sb: sbResponseBody)
    if success != true {
        print("\(rest.LastErrorText)")
        return
    }

    var respStatusCode: Int = rest.ResponseStatusCode.intValue
    if respStatusCode >= 400 {
        print("Response Status Code = \(respStatusCode)")
        print("Response Header:")
        print("\(rest.ResponseHeader)")
        print("Response Body:")
        print("\(sbResponseBody.GetAsString())")
        return
    }

    let jsonResponse = CkoJsonObject()
    jsonResponse.LoadSb(sbResponseBody)

    var self: String?
    var maxResults: Int
    var startAt: Int
    var total: Int
    var isLast: Bool
    var i: Int
    var count_i: Int
    var id: String?
    var authorSelf: String?
    var authorName: String?
    var authorKey: String?
    var authorAccountId: String?
    var authorEmailAddress: String?
    var authorAvatarUrls48x48: String?
    var authorAvatarUrls24x24: String?
    var authorAvatarUrls16x16: String?
    var authorAvatarUrls32x32: String?
    var authorDisplayName: String?
    var authorActive: Bool
    var authorTimeZone: String?
    var created: String?
    var historyMetadataType: String?
    var historyMetadataDescription: String?
    var historyMetadataDescriptionKey: String?
    var historyMetadataActivityDescription: String?
    var historyMetadataActivityDescriptionKey: String?
    var historyMetadataActorId: String?
    var historyMetadataActorDisplayName: String?
    var historyMetadataActorType: String?
    var historyMetadataActorAvatarUrl: String?
    var historyMetadataActorUrl: String?
    var historyMetadataGeneratorId: String?
    var historyMetadataGeneratorType: String?
    var historyMetadataCauseId: String?
    var historyMetadataCauseType: String?
    var historyMetadataExtraDataKeyvalue: String?
    var historyMetadataExtraDataGoes: String?
    var j: Int
    var count_j: Int
    var field: String?
    var fieldtype: String?
    var from: String?
    var fromString: String?
    var v_to: String?
    var toString: String?
    var fieldId: String?

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

        i = i + 1
    }


}

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"
        }
      ]
    }
  ]
}