Page cover

๐Ÿš›Scheme

Gets Workflows Schemes

GET /rest/api/{2-3}/workflowscheme

Returns a paginated list of all workflow schemes, not including draft workflow schemes.

package main

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

func main() {

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

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

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

	workflowSchemes, response, err := instance.Workflow.Scheme.Gets(context.Background(), 0, 50)
	if err != nil {
		if response != nil {
			log.Println(response.Bytes.String())
			log.Println(response.Code)
		}

		log.Fatal(err)
	}

	for _, workflowScheme := range workflowSchemes.Values {
		fmt.Println(workflowScheme.Name)
		fmt.Println(workflowScheme.Description)
		fmt.Println(workflowScheme.ID)
		fmt.Println(workflowScheme.Self)
		fmt.Println(workflowScheme.DefaultWorkflow)
	}

	fmt.Println(workflowSchemes.IsLast)
}

Create Workflows Scheme

POST /rest/api/{2-3}/workflowscheme

Creates a workflow scheme.

Get Workflow Scheme

GET /rest/api/{2-3}/workflowscheme/{id}

Returns a workflow scheme.

Update Workflow Scheme

PUT /rest/api/{2-3}/workflowscheme/{id}

Updates a workflow scheme, including the name, default workflow, issue type to project mappings, and more. If the workflow scheme is active (that is, being used by at least one project), then a draft workflow scheme is created or updated instead, provided that updateDraftIfNeeded is set to true.

Delete Workflow Scheme

DELETE /rest/api/{2-3}/workflowscheme/{id}

Delete deletes a workflow scheme. Please note that a workflow scheme cannot be deleted if it is active (that is, being used by at least one project).

Get Workflow Schemes Associations

GET /rest/api/{2-3}/workflowscheme/project

Associations returns a list of the workflow schemes associated with a list of projects.

  • Each returned workflow scheme includes a list of the requested projects associated with it.

  • Any team-managed or non-existent projects in the request are ignored and no errors are returned.

If the project is associated with the Default Workflow Scheme no ID is returned. This is because the way the Default Workflow Scheme is stored means it has no ID.

Assign Workflow Scheme

PUT /rest/api/{2-3}/workflowscheme/project

Assign assigns a workflow scheme to a project. This operation is performed only when there are no issues in the project. The workflow schemes can only be assigned to classic projects.

Last updated

Was this helpful?