Page cover

๐Ÿ•ฐ๏ธWorklogs

Get Issue Worklogs

GET /rest/api/{2-3}/issue/{issueIdOrKey}/worklog

Returns worklogs for an issue, starting from the oldest worklog or from the worklog started on or after a date and time.

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 {
		log.Fatal(err)
	}

	atlassian.Auth.SetBasicAuth(mail, token)

	var (
		ctx = context.Background()
		key = "KP-1"
		maxResult = 50
		after = 0
		expand = []string{""}
	)

	worklogs, response, err := atlassian.Issue.Worklog.Issue(ctx, key, 0, maxResult, after, expand)
	if err != nil {
		log.Fatal(err)
	}

	log.Println(response.Endpoint, response.Code)

	for _, worklog := range worklogs.Worklogs {
		log.Println(worklog.ID)
	}
}

Add Worklog

POST /rest/api/{2-3}/issue/{issueIdOrKey}/worklog

Adds a worklog to an issue.

Get Worklog

GET /rest/api/{2-3}/issue/{issueIdOrKey}/worklog/{id}

Returns a worklog.

Update Worklog

PUT /rest/api/{2-3}/issue/{issueIdOrKey}/worklog/{id}

Updates a worklog.

Delete Worklog

DELETE /rest/api/{2-3}/issue/{issueIdOrKey}/worklog/{id}

Deletes a worklog from an issue.

Get ID's of deleted worklogs

GET /rest/api/{2-3}/worklog/deleted

Returns a list of IDs and delete timestamps for worklogs deleted after a date and time.

Get Worklogs

POST /rest/api/{2-3}/worklog/list

Returns worklog details for a list of worklog IDs.

Get ID's of updated worklogs

GET /rest/api/{2-3}/worklog/updated

Returns a list of IDs and update timestamps for worklogs updated after a date and time.

This resource is paginated, with a limit of 1000 worklogs per page. Each page lists worklogs from oldest to youngest. If the number of items in the date range exceeds 1000, until indicates the timestamp of the youngest item on the page. Also, nextPage provides the URL for the next page of worklogs. The lastPage parameter is set to true on the last page of worklogs.c

Last updated

Was this helpful?