LogoLogo
  • ๐Ÿ“‘Introduction
  • ๐Ÿ› ๏ธCookbooks
    • โฑ๏ธExport Issue History
    • ๐Ÿ‘พCreate Jira Issue
    • ๐ŸงฉExtract customfields from issue(s)
    • ๐ŸŒ„Upload Content Attachment
    • ๐ŸšฎCreate Jira ITSM Request
    • ๐ŸšœEdit Jira Issue (Explicit)
    • ๐Ÿš›Edit Jira Issue (Implicit)
    • ๐ŸšŽCreate Jira Workflow
    • ๐Ÿ—ƒ๏ธAdd CustomField to Screen
    • ๐ŸšŸSearch Project Boards
    • ๐Ÿ“…Get User Last-Login Info
    • ๐Ÿค’Remove User Access
    • ๐ŸคฏSuspend User Access
    • ๐ŸฅณRestore User Access
    • ๐Ÿš‹Extract Project Administrators
    • ๐ŸงบSearch Jira User By Email
    • ๐ŸšžSearch Contents By CQL
    • ๐ŸŒŠCascade Permissions from Parent to Child
    • ๐ŸŽญPage Permission Helper
    • ๐Ÿค–Atlassian SCIM Onboarding
    • ๐Ÿ˜ƒCreate User via SCIM
    • ๐Ÿ›ฐ๏ธIssue Permission Helper
  • Jira Software Cloud
    • ๐Ÿ—ƒ๏ธIntroduction
    • ๐Ÿ“ฎAnnouncement Banner
    • ๐Ÿ”Application Roles
    • ๐Ÿ›ก๏ธ Audit records
    • ๐Ÿ“ˆDashboards
    • ๐Ÿ—„๏ธFilters
      • ๐ŸคSharing
    • ๐Ÿ‘ซGroups
    • ๐ŸžIssues
      • ๐Ÿ“ŽAttachments
      • ๐Ÿ“ฌComments
      • ๐ŸƒFields
        • ๐Ÿ–ผ๏ธConfiguration
          • ๐ŸคItems
          • ๐Ÿ”ƒSchemes
        • ๐ŸณContext
          • ๐Ÿ•งOption
        • ๐Ÿ—‘๏ธTrash
      • ๐Ÿท๏ธ Labels
      • ๐Ÿ”—Link
        • ๐Ÿ”ƒRemote
        • ๐Ÿ–‡๏ธTypes
      • ๐Ÿš›Metadata
      • ๐ŸฃPriorities
      • ๐Ÿ€Resolutions
      • ๐Ÿ“ŒSearch
      • ๐Ÿ“ฆType
        • ๐ŸŽดScheme
        • ๐Ÿ›…Screen Scheme
      • ๐Ÿ“ Vote
      • ๐ŸŽฏWatcher
      • ๐Ÿ•ฐ๏ธWorklogs
      • ๐Ÿ“คProperties
      • ๐Ÿ“ญArchiving
    • ๐Ÿ”“Permissions
      • ๐Ÿ“œScheme
        • ๐Ÿ”‘Grant
    • ๐Ÿ“šProjects
      • ๐ŸงฉCategories
      • ๐Ÿ”ฎComponents
      • ๐ŸšงPermission Schemes
      • ๐Ÿ“ฌNotification Schemes
      • ๐Ÿ’ผRoles
        • ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘งActors
      • ๐ŸงตTypes
      • ๐ŸงฑVersions
      • ๐Ÿช”Validation
      • ๐Ÿ™ŒFeatures
      • ๐Ÿ“คProperties
    • ๐Ÿ““Screens
      • ๐Ÿ“‚Tabs
        • ๐ŸงฐFields
      • ๐Ÿ“ Schemes
    • โš™๏ธServer
    • ๐Ÿ”ฉJQL
    • โš—๏ธTasks
    • ๐Ÿค“Users
      • ๐Ÿ“ Search
    • ๐Ÿ–จ๏ธWorkflow
      • ๐Ÿš›Scheme
        • ๐Ÿ“ฏIssue Type
      • ๐Ÿ—บ๏ธStatus
    • โš–๏ธMyself
    • ๐Ÿ“Teams
  • Jira Agile
    • ๐Ÿœ๏ธIntroduction
    • ๐Ÿ“‰Boards
      • ๐Ÿ“ƒBacklog
    • ๐Ÿ—“๏ธSprints
    • ๐Ÿ“ˆEpics
  • Jira Service Management
    • ๐Ÿ—บ๏ธIntroduction
    • ๐Ÿ‘จโ€โš–๏ธCustomer
    • โ„น๏ธInfo
    • ๐Ÿ“šKnowledgebase
    • ๐Ÿ›‚Organization
    • ๐Ÿ“™Request
      • ๐ŸšซApproval
      • ๐Ÿ“‚Attachments
      • ๐Ÿ“ฌComments
      • ๐Ÿ“ฎFeedback
      • ๐Ÿ‘ฅParticipants
      • โฐSLA
      • ๐Ÿ’พTypes
      • โš™๏ธService Desk
        • ๐Ÿ›Ž๏ธQueue
    • ๐Ÿ“™Workspaces
  • Jira Assets
    • ๐Ÿ“ Introduction
    • ๐Ÿ‘พIcons
    • ๐Ÿ”ŽAql
    • ๐Ÿ›๏ธObject
      • ๐Ÿ“ Schema
      • ๐ŸงฐType
        • ๐Ÿ›Ž๏ธAttribute
  • Confluence Cloud
    • ๐ŸŽ‘Introduction
    • ๐Ÿ“‰Analytics
    • ๐Ÿ“ขContent
      • ๐ŸŽฎProperties
      • ๐Ÿ“‚Attachments
      • ๐Ÿ“ฌComments
      • ๐ŸšฉLabels
      • ๐ŸŽŽChildren/Descendants
      • ๐Ÿ›ก๏ธPermissions
      • ๐Ÿ”žRestrictions
        • ๐ŸŽ‘Operations
          • ๐Ÿซ‚Group
          • ๐Ÿ‘คUser
      • ๐Ÿ”ƒVersions
    • ๐Ÿ’พSpace
      • ๐Ÿ›ก๏ธPermissions
    • ๐Ÿ”ฐLabel
    • ๐Ÿ”ŽSearch
    • ๐Ÿ–ผ๏ธLong Task
    • ๐Ÿ—ƒ๏ธTemplate
    • ๐ŸŒŠV2
      • ๐Ÿ”๏ธIntroduction
      • ๐ŸงบAttachments
        • ๐Ÿ’ปVersions
      • ๐Ÿ“ƒPage
      • ๐ŸชŸSpace
      • ๐Ÿ—ƒ๏ธCustom Content
  • Atlassian Admin Cloud
    • ๐ŸŒŒIntroduction
    • โ„น๏ธOrganization
      • ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆDirectory
      • ๐Ÿ‘”Policy
    • ๐Ÿ‘ฅUser
      • ๐Ÿ”“Token
    • ๐ŸงฐSCIM
      • ๐Ÿง™โ€โ™‚๏ธUsers
      • โ›น๏ธโ€โ™‚๏ธGroups
      • ๐Ÿ”ฉSchemas
  • Bitbucket Cloud
    • ๐Ÿ‘จโ€๐Ÿ’ปIntroduction
    • ๐Ÿ“ฐWorkspace
      • ๐Ÿ›ก๏ธPermissions
      • ๐Ÿ’พWebhooks
Powered by GitBook
On this page
  • Get issues for backlog
  • Get configuration
  • Create board
  • Get epics
  • Get board by filter id
  • Get board
  • Get issues for board
  • Get board issues for epic
  • Get board issues for sprint
  • Get issues without epic for board
  • Move issues to backlog for board
  • Get projects
  • Get all sprints
  • Get all versions
  • Delete Board
  • Get Boards

Was this helpful?

Export as PDF
  1. Jira Agile

Boards

A board displays issues from one or more projects, giving you a flexible way of viewing, managing, and reporting on work in progress.

Get issues for backlog

GET /rest/agile/1.0/board/{boardId}/backlog

Returns all issues from the board's backlog, for the given board ID.

  • This only includes issues that the user has permission to view.

  • The backlog contains incomplete issues that are not assigned to any future or active sprint.

Note, if the user does not have permission to view the board, no issues will be returned at all.

Issues returned from this resource include Agile fields, like sprint, closedSprints, flagged, and epic. By default, the returned issues are ordered by rank.

package main

import (
	"context"
	"github.com/ctreminiom/go-atlassian/jira/agile"
	"github.com/ctreminiom/go-atlassian/pkg/infra/models"
	"log"
	"os"
)

func main() {

	var (
		host  = os.Getenv("HOST")
		mail  = os.Getenv("MAIL")
		token = os.Getenv("TOKEN")
	)

	atlassian, err := agile.New(nil, host)
	if err != nil {
		return
	}

	atlassian.Auth.SetBasicAuth(mail, token)
	atlassian.Auth.SetUserAgent("curl/7.54.0")

	var (
		options = &models.IssueOptionScheme{
			JQL:           "project = KP",
			ValidateQuery: true,
			Fields:        []string{"status", "issuetype", "summary"},
			Expand:        []string{"changelog"},
		}

		boardID   = 4
		startAt   = 0
		maxResult = 50
	)

	issues, response, err := atlassian.Board.Backlog(context.Background(), boardID, startAt, maxResult, options)
	if err != nil {
		if response != nil {
			log.Println("Response HTTP Response", string(response.Bytes.Bytes()))
		}
		log.Fatal(err)
	}

	log.Println("Response HTTP Code", response.Code)
	log.Println("HTTP Endpoint Used", response.Endpoint)

	for _, issue := range issues.Issues {
		log.Println(issue.Key)
	}
}

Get configuration

GET /rest/agile/1.0/board/{boardId}/configuration

Get the board configuration.

package main

import (
	"context"
	"github.com/ctreminiom/go-atlassian/jira/agile"
	"log"
	"os"
)

func main() {

	var (
		host  = os.Getenv("HOST")
		mail  = os.Getenv("MAIL")
		token = os.Getenv("TOKEN")
	)

	atlassian, err := agile.New(nil, host)
	if err != nil {
		return
	}

	atlassian.Auth.SetBasicAuth(mail, token)
	atlassian.Auth.SetUserAgent("curl/7.54.0")

	boardConfig, response, err := atlassian.Board.Configuration(context.Background(), 4)
	if err != nil {
		if response != nil {
			log.Println("Response HTTP Response", response.Bytes.String())
		}
		log.Fatal(err)
	}

	log.Println("Response HTTP Code", response.Code)
	log.Println("HTTP Endpoint Used", response.Endpoint)
	log.Println(boardConfig)
}

Create board

POST /rest/agile/1.0/board

Creates a new board. Board name, type ,and filter ID is required

package main

import (
	"context"
	"github.com/ctreminiom/go-atlassian/jira/agile"
	"github.com/ctreminiom/go-atlassian/pkg/infra/models"
	"log"
	"os"
)

func main() {

	var (
		host  = os.Getenv("HOST")
		mail  = os.Getenv("MAIL")
		token = os.Getenv("TOKEN")
	)

	atlassian, err := agile.New(nil, host)
	if err != nil {
		return
	}

	atlassian.Auth.SetBasicAuth(mail, token)
	atlassian.Auth.SetUserAgent("curl/7.54.0")

	newBoard := &models.BoardPayloadScheme{
		Name:     "DUMMY Board Name",
		Type:     "scrum", //scrum or kanban
		FilterID: 10016,

		// Omit the Location if you want to the board to yourself (location)
		Location: &models.BoardPayloadLocationScheme{
			ProjectKeyOrID: "KP",
			Type:           "project",
		},
	}

	board, response, err := atlassian.Board.Create(context.Background(), newBoard)
	if err != nil {
		if response != nil {
			log.Println("Response HTTP Response", response.Bytes.String())
		}
		log.Fatal(err)
	}

	log.Println("Response HTTP Code", response.Code)
	log.Println("HTTP Endpoint Used", response.Endpoint)
	log.Println(board)
}

Get epics

GET /rest/agile/1.0/board/{boardId}/epic

Returns all epics from the board, for the given board ID. This only includes epics that the user has permission to view. Note, if the user does not have permission to view the board, no epics will be returned at all.

package main

import (
	"context"
	"github.com/ctreminiom/go-atlassian/jira/agile"
	"log"
	"os"
)

func main() {

	var (
		host  = os.Getenv("HOST")
		mail  = os.Getenv("MAIL")
		token = os.Getenv("TOKEN")
	)

	atlassian, err := agile.New(nil, host)
	if err != nil {
		return
	}

	atlassian.Auth.SetBasicAuth(mail, token)
	atlassian.Auth.SetUserAgent("curl/7.54.0")

	epicsPage, response, err := atlassian.Board.Epics(context.Background(), 4, 0, 50, false)
	if err != nil {
		if response != nil {
			log.Println("Response HTTP Response", response.Bytes.String())
		}
		log.Fatal(err)
	}

	log.Println("Response HTTP Code", response.Code)
	log.Println("HTTP Endpoint Used", response.Endpoint)

	for _, epic := range epicsPage.Values {
		log.Println(epic)
	}
}

Get board by filter id

GET /rest/agile/1.0/board/filter/{filterId}

Returns any boards which use the provided filter id. This method can be executed by users without a valid software license in order to find which boards are using a particular filter.

package main

import (
	"context"
	"github.com/ctreminiom/go-atlassian/jira/agile"
	"log"
	"os"
)

func main() {

	var (
		host  = os.Getenv("HOST")
		mail  = os.Getenv("MAIL")
		token = os.Getenv("TOKEN")
	)

	atlassian, err := agile.New(nil, host)
	if err != nil {
		return
	}

	atlassian.Auth.SetBasicAuth(mail, token)
	atlassian.Auth.SetUserAgent("curl/7.54.0")

	var (
		filterID  = 10016
		startAt   = 0
		maxResult = 50
	)

	boards, response, err := atlassian.Board.Filter(context.Background(), filterID, startAt, maxResult)
	if err != nil {
		if response != nil {
			log.Println("Response HTTP Response", response.Bytes.String())
		}
		log.Fatal(err)
	}

	log.Println("Response HTTP Code", response.Code)
	log.Println("HTTP Endpoint Used", response.Endpoint)

	for _, board := range boards.Values {
		log.Println(board.Name, board.ID, board.Type)
	}
}

Get board

GET /rest/agile/1.0/board/{boardId}

Returns the board for the given board ID.

  • This board will only be returned if the user has permission to view it.

  • Admins without the view permission will see the board as a private one, so will see only a subset of the board's data (board location for instance).

package main

import (
	"context"
	"fmt"
	"github.com/ctreminiom/go-atlassian/jira/agile"
	"log"
	"os"
)

func main() {

	var (
		host  = os.Getenv("HOST")
		mail  = os.Getenv("MAIL")
		token = os.Getenv("TOKEN")
	)

	atlassian, err := agile.New(nil, host)
	if err != nil {
		return
	}

	atlassian.Auth.SetBasicAuth(mail, token)
	atlassian.Auth.SetUserAgent("curl/7.54.0")

	board, response, err := atlassian.Board.Get(context.Background(), 4)
	if err != nil {
		if response != nil {
			log.Println("Response HTTP Response", response.Bytes.String())
		}
		log.Fatal(err)
	}

	log.Println("Response HTTP Code", response.Code)
	log.Println("HTTP Endpoint Used", response.Endpoint)
	log.Println(board)
	log.Println(board.Location)

	fmt.Println(response.Bytes.String())

}

Get issues for board

GET /rest/agile/1.0/board/{boardId}/issue

Returns all issues from a board, for a given board ID.

  • This only includes issues that the user has permission to view.

  • An issue belongs to the board if its status is mapped to the board's column.

  • Epic issues do not belongs to the scrum boards.

  • Issues returned from this resource include Agile fields, like sprint, closedSprints, flagged, and epic. By default, the returned issues are ordered by rank.

Note, if the user does not have permission to view the board, no issues will be returned at all.

package main

import (
	"context"
	"github.com/ctreminiom/go-atlassian/jira/agile"
	"github.com/ctreminiom/go-atlassian/pkg/infra/models"
	"log"
	"os"
)

func main() {

	var (
		host  = os.Getenv("HOST")
		mail  = os.Getenv("MAIL")
		token = os.Getenv("TOKEN")
	)

	atlassian, err := agile.New(nil, host)
	if err != nil {
		return
	}

	atlassian.Auth.SetBasicAuth(mail, token)
	atlassian.Auth.SetUserAgent("curl/7.54.0")

	var (
		options = &models.IssueOptionScheme{
			//JQL:           "project = KP",
			//ValidateQuery: true,
			Fields: []string{"status", "issuetype", "summary"},
			Expand: []string{"changelog"},
		}

		boardID   = 4
		startAt   = 0
		maxResult = 50
	)

	issuesPage, response, err := atlassian.Board.Issues(context.Background(), boardID, options, startAt, maxResult)
	if err != nil {
		if response != nil {
			log.Println("Response HTTP Response", response.Bytes.String())
		}
		log.Fatal(err)
	}

	log.Println("Response HTTP Code", response.Code)
	log.Println("HTTP Endpoint Used", response.Endpoint)

	for _, issue := range issuesPage.Issues {
		log.Println(issue.Key)
	}
}

Get board issues for epic

GET /rest/agile/1.0/board/{boardId}/epic/{epicId}/issue

Returns all issues that belong to an epic on the board, for the given epic ID and the board ID.

  • This only includes issues that the user has permission to view.

  • Issues returned from this resource include Agile fields, like sprint, closedSprints, flagged, and epic. By default, the returned issues are ordered by rank.

package main

import (
	"context"
	"github.com/ctreminiom/go-atlassian/jira/agile"
	"github.com/ctreminiom/go-atlassian/pkg/infra/models"
	"log"
	"os"
)

func main() {

	var (
		host  = os.Getenv("HOST")
		mail  = os.Getenv("MAIL")
		token = os.Getenv("TOKEN")
	)

	atlassian, err := agile.New(nil, host)
	if err != nil {
		return
	}

	atlassian.Auth.SetBasicAuth(mail, token)
	atlassian.Auth.SetUserAgent("curl/7.54.0")

	var (
		options = &models.IssueOptionScheme{
			//JQL:           "project = KP",
			//ValidateQuery: true,
			Fields: []string{"status", "issuetype", "summary"},
			Expand: []string{"changelog"},
		}

		boardID   = 4
		epicID    = 10029
		startAt   = 0
		maxResult = 50
	)

	issuesPage, response, err := atlassian.Board.IssuesByEpic(context.Background(), boardID, epicID, options, startAt, maxResult)
	if err != nil {
		if response != nil {
			log.Println("Response HTTP Response", response.Bytes.String())
		}
		log.Fatal(err)
	}

	log.Println("Response HTTP Code", response.Code)
	log.Println("HTTP Endpoint Used", response.Endpoint)

	for _, issue := range issuesPage.Issues {
		log.Println(issue.Key)
	}
}

Get board issues for sprint

GET /rest/agile/1.0/board/{boardId}/sprint/{sprintId}/issue

Get all issues you have access to that belong to the sprint from the board.

  • Issue returned from this resource contains additional fields like: sprint, closedSprints, flagged and epic. Issues are returned ordered by rank. JQL order has higher priority than default rank.

package main

import (
	"context"
	"github.com/ctreminiom/go-atlassian/jira/agile"
	"github.com/ctreminiom/go-atlassian/pkg/infra/models"
	"log"
	"os"
)

func main() {

	var (
		host  = os.Getenv("HOST")
		mail  = os.Getenv("MAIL")
		token = os.Getenv("TOKEN")
	)

	atlassian, err := agile.New(nil, host)
	if err != nil {
		return
	}

	atlassian.Auth.SetBasicAuth(mail, token)
	atlassian.Auth.SetUserAgent("curl/7.54.0")

	var (
		options = &models.IssueOptionScheme{
			//JQL:           "project = KP",
			//ValidateQuery: true,
			Fields: []string{"status", "issuetype", "summary"},
			Expand: []string{"changelog"},
		}

		boardID   = 4
		sprintID  = 4
		startAt   = 0
		maxResult = 50
	)

	issuesPage, response, err := atlassian.Board.IssuesBySprint(context.Background(), boardID, sprintID, options, startAt, maxResult)
	if err != nil {
		if response != nil {
			log.Println("Response HTTP Response", response.Bytes.String())
		}
		log.Fatal(err)
	}

	log.Println("Response HTTP Code", response.Code)
	log.Println("HTTP Endpoint Used", response.Endpoint)

	for _, issue := range issuesPage.Issues {
		log.Println(issue.Key)
	}
}

Get issues without epic for board

GET /rest/agile/1.0/board/{boardId}/epic/none/issue

Returns all issues that do not belong to any epic on a board, for a given board ID. This only includes issues that the user has permission to view. Issues returned from this resource include Agile fields, like sprint, closedSprints, flagged, and epic. By default, the returned issues are ordered by rank.

package main

import (
	"context"
	"github.com/ctreminiom/go-atlassian/jira/agile"
	"github.com/ctreminiom/go-atlassian/pkg/infra/models"
	"log"
	"os"
)

func main() {

	var (
		host  = os.Getenv("HOST")
		mail  = os.Getenv("MAIL")
		token = os.Getenv("TOKEN")
	)

	atlassian, err := agile.New(nil, host)
	if err != nil {
		return
	}

	atlassian.Auth.SetBasicAuth(mail, token)
	atlassian.Auth.SetUserAgent("curl/7.54.0")

	var (
		options = &models.IssueOptionScheme{
			JQL:           "project = KP",
			ValidateQuery: true,
			Fields:        []string{"status", "issuetype", "summary"},
			Expand:        []string{"changelog"},
		}

		boardID   = 4
		startAt   = 0
		maxResult = 50
	)

	issuesPage, response, err := atlassian.Board.IssuesWithoutEpic(context.Background(), boardID, options, startAt, maxResult)
	if err != nil {
		if response != nil {
			log.Println("Response HTTP Response", response.Bytes.String())
		}
		log.Fatal(err)
	}

	log.Println("Response HTTP Code", response.Code)
	log.Println("HTTP Endpoint Used", response.Endpoint)

	for _, issue := range issuesPage.Issues {
		log.Println(issue.Key)
	}
}

Move issues to backlog for board

POST /rest/agile/1.0/board/{boardId}/issue

Move issues to the backlog of a particular board (if they are already on that board).

This operation is equivalent to remove future and active sprints from a given set of issues if the board has sprints If the board does not have sprints this will put the issues back into the backlog from the board. At most 50 issues may be moved at once.

package main

import (
	"context"
	"github.com/ctreminiom/go-atlassian/jira/agile"
	"github.com/ctreminiom/go-atlassian/pkg/infra/models"
	"log"
	"os"
)

func main() {

	var (
		host  = os.Getenv("HOST")
		mail  = os.Getenv("MAIL")
		token = os.Getenv("TOKEN")
	)

	atlassian, err := agile.New(nil, host)
	if err != nil {
		return
	}

	atlassian.Auth.SetBasicAuth(mail, token)
	atlassian.Auth.SetUserAgent("curl/7.54.0")

	var (
		boardID = 7
		payload = &models.BoardMovementPayloadScheme{
			Issues:          []string{"KP-3"},
			RankBeforeIssue: "",
			RankAfterIssue:  "",
		}
	)

	response, err := atlassian.Board.Move(context.Background(), boardID, payload)
	if err != nil {
		if response != nil {
			log.Println("Response HTTP Response", response.Bytes.String())
		}
		log.Fatal(err)
	}

	log.Println("Response HTTP Code", response.Code)
	log.Println("HTTP Endpoint Used", response.Endpoint)
}

Get projects

GET /rest/agile/1.0/board/{boardId}/project

Returns all projects that are associated with the board, for the given board ID. If the user does not have permission to view the board, no projects will be returned at all. Returned projects are ordered by the name.

package main

import (
	"context"
	"github.com/ctreminiom/go-atlassian/jira/agile"
	"log"
	"os"
)

func main() {

	var (
		host  = os.Getenv("HOST")
		mail  = os.Getenv("MAIL")
		token = os.Getenv("TOKEN")
	)

	atlassian, err := agile.New(nil, host)
	if err != nil {
		return
	}

	atlassian.Auth.SetBasicAuth(mail, token)
	atlassian.Auth.SetUserAgent("curl/7.54.0")

	projects, response, err := atlassian.Board.Projects(context.Background(), 4, 0, 50)
	if err != nil {
		if response != nil {
			log.Println("Response HTTP Response", response.Bytes.String())
		}
		log.Fatal(err)
	}

	log.Println("Response HTTP Code", response.Code)
	log.Println("HTTP Endpoint Used", response.Endpoint)

	for _, project := range projects.Values {
		log.Println(project)
	}
}

Get all sprints

GET /rest/agile/1.0/board/{boardId}/sprint

Returns all sprints from a board, for a given board ID. This only includes sprints that the user has permission to view.

package main

import (
	"context"
	"fmt"
	"github.com/ctreminiom/go-atlassian/jira/agile"
	"log"
	"os"
)

func main() {

	var (
		host  = os.Getenv("HOST")
		mail  = os.Getenv("MAIL")
		token = os.Getenv("TOKEN")
	)

	atlassian, err := agile.New(nil, host)
	if err != nil {
		return
	}

	atlassian.Auth.SetBasicAuth(mail, token)
	atlassian.Auth.SetUserAgent("curl/7.54.0")

	var (
		boardID   = 4
		states    = []string{"future", "active"} // valid values: future, active, closed
		startAt   = 0
		maxResult = 50
	)

	sprints, response, err := atlassian.Board.Sprints(context.Background(), boardID, startAt, maxResult, states)
	if err != nil {
		if response != nil {
			log.Println("Response HTTP Response", response.Bytes.String())
		}
		log.Fatal(err)
	}

	log.Println("Response HTTP Code", response.Code)
	log.Println("HTTP Endpoint Used", response.Endpoint)

	for _, sprint := range sprints.Values {
		log.Println(sprint)
	}

	fmt.Println(response.Bytes.String())
}

Get all versions

GET /rest/agile/1.0/board/{boardId}/version

Returns all versions from a board, for a given board ID. This only includes versions that the user has permission to view. Note, if the user does not have permission to view the board, no versions will be returned at all. Returned versions are ordered by the name of the project from which they belong and then by sequence defined by user.

package main

import (
	"context"
	"fmt"
	"github.com/ctreminiom/go-atlassian/jira/agile"
	"log"
	"os"
)

func main() {

	var (
		host  = os.Getenv("HOST")
		mail  = os.Getenv("MAIL")
		token = os.Getenv("TOKEN")
	)

	atlassian, err := agile.New(nil, host)
	if err != nil {
		return
	}

	atlassian.Auth.SetBasicAuth(mail, token)
	atlassian.Auth.SetUserAgent("curl/7.54.0")

	var (
		boardID    = 4
		startAt    = 0
		maxResults = 50
		released   = false
	)

	versionsPage, response, err := atlassian.Board.Versions(context.Background(), boardID, startAt, maxResults, released)
	if err != nil {
		if response != nil {
			log.Println("Response HTTP Response", response.Bytes.String())
		}
		log.Fatal(err)
	}

	log.Println("Response HTTP Code", response.Code)
	log.Println("HTTP Endpoint Used", response.Endpoint)

	for _, version := range versionsPage.Values {
		log.Println(version)
	}

	fmt.Println(response.Bytes.String())
}

Delete Board

DELETE /rest/agile/1.0/board/{boardId}

Delete deletes the board. Admin without the view permission can still remove the board.

package main

import (
	"context"
	"github.com/ctreminiom/go-atlassian/jira/agile"
	"log"
	"os"
)

func main() {

	var (
		host  = os.Getenv("HOST")
		mail  = os.Getenv("MAIL")
		token = os.Getenv("TOKEN")
	)

	atlassian, err := agile.New(nil, host)
	if err != nil {
		return
	}

	atlassian.Auth.SetBasicAuth(mail, token)
	atlassian.Auth.SetUserAgent("curl/7.54.0")

	response, err := atlassian.Board.Delete(context.Background(), 4)
	if err != nil {
		if response != nil {
			log.Println("Response HTTP Response", response.Bytes.String())
		}
		log.Fatal(err)
	}

	log.Println("Response HTTP Code", response.Code)
	log.Println("HTTP Endpoint Used", response.Endpoint)
}

Get Boards

GET /rest/agile/1.0/board

Gets returns all boards. This only includes boards that the user has permission to view.

package main

import (
	"context"
	"github.com/ctreminiom/go-atlassian/jira/agile"
	"github.com/ctreminiom/go-atlassian/pkg/infra/models"
	"log"
	"os"
)

func main() {

	var (
		host  = os.Getenv("HOST")
		mail  = os.Getenv("MAIL")
		token = os.Getenv("TOKEN")
	)

	atlassian, err := agile.New(nil, host)
	if err != nil {
		return
	}

	atlassian.Auth.SetBasicAuth(mail, token)
	atlassian.Auth.SetUserAgent("curl/7.54.0")

	options := &models.GetBoardsOptions{
		BoardType:               "",
		BoardName:               "",
		ProjectKeyOrID:          "",
		AccountIDLocation:       "",
		ProjectIDLocation:       "",
		IncludePrivate:          true,
		NegateLocationFiltering: false,
		OrderBy:                 "",
		Expand:                  "",
		FilterID:                0,
	}

	boards, response, err := atlassian.Board.Gets(context.Background(), options, 0, 50)
	if err != nil {
		if response != nil {
			log.Println("Response HTTP Response", response.Bytes.String())
		}
		log.Fatal(err)
	}

	log.Println("Response HTTP Code", response.Code)
	log.Println("HTTP Endpoint Used", response.Endpoint)

	for _, board := range boards.Values {
		log.Println(board)
	}
}
PreviousIntroductionNextBacklog

Last updated 1 year ago

Was this helpful?

๐Ÿ“‰
Page cover image