Page cover

๐ŸƒFields

Get fields

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

Returns system and custom issue fields according to the following rules:

  • Fields that cannot be added to the issue navigator are always returned.

  • Fields that cannot be placed on an issue screen are always returned.

  • Fields that depend on global Jira settings are only returned if the setting is enabled. That is, timetracking fields, subtasks, votes, and watches.

package main

import (
	"context"
	"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")
	)

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

	atlassian.Auth.SetBasicAuth(mail, token)

	fields, response, err := atlassian.Issue.Field.Gets(context.Background())
	if err != nil {
		log.Fatal(err)
		return
	}

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

	for _, field := range fields {
		log.Println(field)
	}
}

Create custom field

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

Creates a custom field, the method returns the following information:

Get fields paginated

GET /rest/api/{2-3}/field/search

Returns a paginated list of fields for Classic Jira projects. The list can include:

  • all fields.

  • specific fields, by defining id.

  • fields that contain a string in the field name or description, by defining query.

  • specific fields that contain a string in the field name or description, by defining id and query.

Only custom fields can be queried, type must be set to custom. the method returns the following information:

Delete Field

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

Deletes a custom field. The custom field is deleted whether it is in the trash or not.

Last updated

Was this helpful?