Sample code for 30+ languages & platforms
VB.NET 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 VB.NET Downloads

VB.NET
Dim success As Boolean = False

'  Assumes Chilkat is unlocked. See Global Unlock Sample.

Dim http As New Chilkat.Http
http.RequireSslCertVerify = True
http.BasicAuth = True
'  Read these credentials from private application configuration.
http.Login = "YOUR_ATLASSIAN_EMAIL"
http.Password = "YOUR_API_TOKEN"
Dim baseUrl As String = "https://your-domain.atlassian.net"
http.Accept = "application/json"
Dim url As New Chilkat.StringBuilder
Dim resp As New Chilkat.HttpResponse
Dim reply As New Chilkat.JsonObject
Dim boardName As String = "Example Board"
Dim sprintName As String = "Sprint 1"
Dim boardId As String = ""
Dim sprintId As String = ""
Dim boardMatches As Integer = 0
Dim sprintMatches As Integer = 0
http.SetUrlVar("projectKey","PROJECT")
http.SetUrlVar("boardName",boardName)
'  Team-managed boards can have type simple, including boards with sprints enabled.
Dim boardsStart As Integer = 0
Dim boardsMore As Boolean = True
Dim boardsOffset As New Chilkat.StringBuilder
While (boardsMore = True)
    boardsOffset.Clear()
    boardsOffset.AppendInt(boardsStart)
    http.SetUrlVar("offset",boardsOffset.GetAsString())
    url.SetString(baseUrl)
    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
        Debug.WriteLine("No HTTP response was received. Check connectivity and TLS settings.")
        Exit Sub
    End If

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

        '  Inspect this response locally; it can contain private Jira data.
        Debug.WriteLine(resp.BodyStr)
        Exit Sub
    End If

    success = reply.Load(resp.BodyStr)
    If (success <> True) Then
        Debug.WriteLine("Expected a JSON object in the response.")
        Exit Sub
    End If

    If (reply.JsonTypeOf("values") <> 4) Then
        Debug.WriteLine("Expected an array: values")
        Exit Sub
    End If

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

        boardsIndex = boardsIndex + 1
    End While
    boardsStart = boardsStart + boardsCount
    boardsMore = (reply.BoolOf("isLast") <> True)
    If ((boardsMore = True) And (boardsCount = 0)) Then
        Debug.WriteLine("Pagination made no progress; stopping.")
        Exit Sub
    End If

End While
If (boardMatches <> 1) Then
    Debug.WriteLine("Expected exactly one matching board in this project.")
    Exit Sub
End If

http.SetUrlVar("boardId",boardId)
Dim sprintsStart As Integer = 0
Dim sprintsMore As Boolean = True
Dim sprintsOffset As New Chilkat.StringBuilder
While (sprintsMore = True)
    sprintsOffset.Clear()
    sprintsOffset.AppendInt(sprintsStart)
    http.SetUrlVar("offset",sprintsOffset.GetAsString())
    url.SetString(baseUrl)
    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
        Debug.WriteLine("No HTTP response was received. Check connectivity and TLS settings.")
        Exit Sub
    End If

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

        '  Inspect this response locally; it can contain private Jira data.
        Debug.WriteLine(resp.BodyStr)
        Exit Sub
    End If

    success = reply.Load(resp.BodyStr)
    If (success <> True) Then
        Debug.WriteLine("Expected a JSON object in the response.")
        Exit Sub
    End If

    If (reply.JsonTypeOf("values") <> 4) Then
        Debug.WriteLine("Expected an array: values")
        Exit Sub
    End If

    Dim sprintsCount As Integer = reply.SizeOfArray("values")
    Dim sprintsIndex As Integer = 0
    While (sprintsIndex < sprintsCount)
        reply.I = sprintsIndex
        Debug.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,True) = True) Then
            sprintId = reply.StringOf("values[i].id")
            sprintMatches = sprintMatches + 1
        End If

        sprintsIndex = sprintsIndex + 1
    End While
    sprintsStart = sprintsStart + sprintsCount
    sprintsMore = (reply.BoolOf("isLast") <> True)
    If ((sprintsMore = True) And (sprintsCount = 0)) Then
        Debug.WriteLine("Pagination made no progress; stopping.")
        Exit Sub
    End If

End While
If (sprintMatches <> 1) Then
    Debug.WriteLine("Expected exactly one matching sprint.")
    Exit Sub
End If

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

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

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

        '  Inspect this response locally; it can contain private Jira data.
        Debug.WriteLine(resp.BodyStr)
        Exit Sub
    End If

    success = reply.Load(resp.BodyStr)
    If (success <> True) Then
        Debug.WriteLine("Expected a JSON object in the response.")
        Exit Sub
    End If

    If (reply.JsonTypeOf("issues") <> 4) Then
        Debug.WriteLine("Expected an array: issues")
        Exit Sub
    End If

    Dim i As Integer = 0
    While (i < reply.SizeOfArray("issues"))
        reply.I = i
        Debug.WriteLine(reply.StringOf("issues[i].key") & "  " & reply.StringOf("issues[i].fields.summary"))
        i = i + 1
    End While
    more = (reply.BoolOf("isLast") <> True)
    If (more = True) Then
        If ((reply.JsonTypeOf("nextPageToken") <> 1) Or (reply.StringOfEquals("nextPageToken","",True) = True)) Then
            Debug.WriteLine("Missing value: nextPageToken")
            Exit Sub
        End If

        nextToken = reply.StringOf("nextPageToken")
        If (nextToken = previousToken) Then
            Debug.WriteLine("Repeated pagination token; stopping.")
            Exit Sub
        End If

        previousToken = nextToken
    End If

End While