๐Ÿ“ญArchiving

Archive issues by issue ID/Key

PUT /rest/api/{2-3}/issue/archive

Preserve archives the given issues based on their issue IDs or keys.

package main

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

func main() {

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

	fmt.Println(host)

	atlassian, err := v2.New(nil, host)
	if err != nil {
		log.Fatal(err)
	}

	atlassian.Auth.SetBasicAuth(mail, token)

	archivalResult, response, err := atlassian.Archive.Preserve(context.Background(), []string{"KP-2"})
	if err != nil {
		if response != nil {
			log.Println("Response HTTP Code", response.Code)
			log.Println("HTTP Endpoint Used", response.Endpoint)
		}
		log.Fatal(err)
	}

	fmt.Println(archivalResult.NumberOfIssuesUpdated)
}

Archive issues by JQL

POST /rest/api/{2-3}/issue/archive

PreserveByJQL archives issues than match the provided JQL query.

Restore issues by issue ID/Key

PUT /rest/api/{2-3}/issue/unarchive

Restore brings back the given archived issues using their issue IDs or keys.

Export archived issues

PUT /rest/api/{2-3}/issues/archive/export

Export generates an export of archived issues based on the provided payload.

Last updated

Was this helpful?