Sample code for 30+ languages & platforms
VBScript Requires Chilkat v11.0.0+

Jira Cloud: List Boards, Sprints, and Sprint Issues

See more Jira Examples

Find a board within a project by name, find a sprint on that board, and list its issues. Each list is paginated. Duplicate board or sprint names are treated as ambiguous; choose an ID explicitly if names are not unique.

Boards and sprints belong to the Jira Software REST API. A board's filter and the user's permissions affect what is visible. Sprints must be enabled for the selected board. Team-managed boards can have type simple even when sprints are enabled, so the discovery request does not restrict results to type=scrum. The final request uses the enhanced sprint-issue endpoint with token pagination, rather than the deprecated offset-based issue endpoint. OAuth integrations need the Jira Software scopes listed by these endpoints in addition to platform scopes.

The code uses an Atlassian account email and an API token without scopes with the site URL. For a scoped API token, keep Basic authentication and change baseUrl to https://api.atlassian.com/ex/jira/YOUR_CLOUD_ID. For OAuth2, use that gateway URL, omit Login/Password/BasicAuth, and set http.AuthToken to the access token. See API token authentication and OAuth2 authorization. The account must have permission for the operation; OAuth scopes do not grant additional Jira permissions.

Targets Jira Cloud. Jira Data Center has a separate REST API and may require different paths, authentication, or payloads.

Atlassian REST API documentation

Chilkat VBScript Downloads

VBScript
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

success = 0

'  Assumes Chilkat is unlocked. See Global Unlock Sample.

set http = CreateObject("Chilkat.Http")
http.RequireSslCertVerify = 1
http.BasicAuth = 1
'  Read these credentials from private application configuration.
http.Login = "YOUR_ATLASSIAN_EMAIL"
http.Password = "YOUR_API_TOKEN"
baseUrl = "https://your-domain.atlassian.net"
http.Accept = "application/json"
set url = CreateObject("Chilkat.StringBuilder")
set resp = CreateObject("Chilkat.HttpResponse")
set reply = CreateObject("Chilkat.JsonObject")
boardName = "Example Board"
sprintName = "Sprint 1"
boardId = ""
sprintId = ""
boardMatches = 0
sprintMatches = 0
success = http.SetUrlVar("projectKey","PROJECT")
success = http.SetUrlVar("boardName",boardName)
'  Team-managed boards can have type simple, including boards with sprints enabled.
boardsStart = 0
boardsMore = 1
set boardsOffset = CreateObject("Chilkat.StringBuilder")
Do While (boardsMore = 1)
    boardsOffset.Clear 
    success = boardsOffset.AppendInt(boardsStart)
    success = http.SetUrlVar("offset",boardsOffset.GetAsString())
    success = url.SetString(baseUrl)
    success = url.Append("/rest/agile/1.0/board?projectKeyOrId={$projectKey}&name={$boardName}&startAt={$offset}&maxResults=50")
    success = http.HttpNoBody("GET",url.GetAsString(),resp)
    If (resp.StatusCode = 0) Then
        outFile.WriteLine("No HTTP response was received. Check connectivity and TLS settings.")
        WScript.Quit
    End If

    If ((success <> 1) Or (resp.StatusCode < 200) Or (resp.StatusCode >= 300)) Then
        outFile.WriteLine("Request failed. HTTP " & resp.StatusCode)
        If (resp.StatusCode = 429) Then
            outFile.WriteLine("Rate limited. Retry-After: " & resp.GetHeaderField("Retry-After"))
        End If

        '  Inspect this response locally; it can contain private Jira data.
        outFile.WriteLine(resp.BodyStr)
        WScript.Quit
    End If

    success = reply.Load(resp.BodyStr)
    If (success <> 1) Then
        outFile.WriteLine("Expected a JSON object in the response.")
        WScript.Quit
    End If

    If (reply.JsonTypeOf("values") <> 4) Then
        outFile.WriteLine("Expected an array: values")
        WScript.Quit
    End If

    boardsCount = reply.SizeOfArray("values")
    boardsIndex = 0
    Do While (boardsIndex < boardsCount)
        reply.I = boardsIndex
        outFile.WriteLine("Board: " & reply.StringOf("values[i].name") & "  ID: " & reply.StringOf("values[i].id"))
        If (reply.StringOfEquals("values[i].name",boardName,1) = 1) Then
            boardId = reply.StringOf("values[i].id")
            boardMatches = boardMatches + 1
        End If

        boardsIndex = boardsIndex + 1
    Loop
    boardsStart = boardsStart + boardsCount
    boardsMore = (reply.BoolOf("isLast") <> 1)
    If ((boardsMore = 1) And (boardsCount = 0)) Then
        outFile.WriteLine("Pagination made no progress; stopping.")
        WScript.Quit
    End If

Loop
If (boardMatches <> 1) Then
    outFile.WriteLine("Expected exactly one matching board in this project.")
    WScript.Quit
End If

success = http.SetUrlVar("boardId",boardId)
sprintsStart = 0
sprintsMore = 1
set sprintsOffset = CreateObject("Chilkat.StringBuilder")
Do While (sprintsMore = 1)
    sprintsOffset.Clear 
    success = sprintsOffset.AppendInt(sprintsStart)
    success = http.SetUrlVar("offset",sprintsOffset.GetAsString())
    success = url.SetString(baseUrl)
    success = url.Append("/rest/agile/1.0/board/{$boardId}/sprint?startAt={$offset}&maxResults=50")
    success = http.HttpNoBody("GET",url.GetAsString(),resp)
    If (resp.StatusCode = 0) Then
        outFile.WriteLine("No HTTP response was received. Check connectivity and TLS settings.")
        WScript.Quit
    End If

    If ((success <> 1) Or (resp.StatusCode < 200) Or (resp.StatusCode >= 300)) Then
        outFile.WriteLine("Request failed. HTTP " & resp.StatusCode)
        If (resp.StatusCode = 429) Then
            outFile.WriteLine("Rate limited. Retry-After: " & resp.GetHeaderField("Retry-After"))
        End If

        '  Inspect this response locally; it can contain private Jira data.
        outFile.WriteLine(resp.BodyStr)
        WScript.Quit
    End If

    success = reply.Load(resp.BodyStr)
    If (success <> 1) Then
        outFile.WriteLine("Expected a JSON object in the response.")
        WScript.Quit
    End If

    If (reply.JsonTypeOf("values") <> 4) Then
        outFile.WriteLine("Expected an array: values")
        WScript.Quit
    End If

    sprintsCount = reply.SizeOfArray("values")
    sprintsIndex = 0
    Do While (sprintsIndex < sprintsCount)
        reply.I = sprintsIndex
        outFile.WriteLine("Sprint: " & reply.StringOf("values[i].name") & "  " & reply.StringOf("values[i].state") & "  ID: " & reply.StringOf("values[i].id"))
        If (reply.StringOfEquals("values[i].name",sprintName,1) = 1) Then
            sprintId = reply.StringOf("values[i].id")
            sprintMatches = sprintMatches + 1
        End If

        sprintsIndex = sprintsIndex + 1
    Loop
    sprintsStart = sprintsStart + sprintsCount
    sprintsMore = (reply.BoolOf("isLast") <> 1)
    If ((sprintsMore = 1) And (sprintsCount = 0)) Then
        outFile.WriteLine("Pagination made no progress; stopping.")
        WScript.Quit
    End If

Loop
If (sprintMatches <> 1) Then
    outFile.WriteLine("Expected exactly one matching sprint.")
    WScript.Quit
End If

success = http.SetUrlVar("sprintId",sprintId)
nextToken = ""
previousToken = ""
more = 1
Do While (more = 1)
    success = http.SetUrlVar("nextToken",nextToken)
    success = url.SetString(baseUrl)
    success = url.Append("/rest/software/1.0/sprint/{$sprintId}/issue?maxResults=50&fields=summary,status")
    If (nextToken <> "") Then
        success = url.Append("&nextPageToken={$nextToken}")
    End If

    success = http.HttpNoBody("GET",url.GetAsString(),resp)
    If (resp.StatusCode = 0) Then
        outFile.WriteLine("No HTTP response was received. Check connectivity and TLS settings.")
        WScript.Quit
    End If

    If ((success <> 1) Or (resp.StatusCode < 200) Or (resp.StatusCode >= 300)) Then
        outFile.WriteLine("Request failed. HTTP " & resp.StatusCode)
        If (resp.StatusCode = 429) Then
            outFile.WriteLine("Rate limited. Retry-After: " & resp.GetHeaderField("Retry-After"))
        End If

        '  Inspect this response locally; it can contain private Jira data.
        outFile.WriteLine(resp.BodyStr)
        WScript.Quit
    End If

    success = reply.Load(resp.BodyStr)
    If (success <> 1) Then
        outFile.WriteLine("Expected a JSON object in the response.")
        WScript.Quit
    End If

    If (reply.JsonTypeOf("issues") <> 4) Then
        outFile.WriteLine("Expected an array: issues")
        WScript.Quit
    End If

    i = 0
    Do While (i < reply.SizeOfArray("issues"))
        reply.I = i
        outFile.WriteLine(reply.StringOf("issues[i].key") & "  " & reply.StringOf("issues[i].fields.summary"))
        i = i + 1
    Loop
    more = (reply.BoolOf("isLast") <> 1)
    If (more = 1) Then
        If ((reply.JsonTypeOf("nextPageToken") <> 1) Or (reply.StringOfEquals("nextPageToken","",1) = 1)) Then
            outFile.WriteLine("Missing value: nextPageToken")
            WScript.Quit
        End If

        nextToken = reply.StringOf("nextPageToken")
        If (nextToken = previousToken) Then
            outFile.WriteLine("Repeated pagination token; stopping.")
            WScript.Quit
        End If

        previousToken = nextToken
    End If

Loop

outFile.Close