0

Update an issue

by
Published Oct 17, 2025

Updates an individual issue's attributes. Only the attributes submitted are modified.

Script sentry Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Update an issue
4
 * Updates an individual issue's attributes.  Only the attributes submitted are modified.
5
 */
6
export async function main(auth: RT.Sentry, issue_id: string, body: Body) {
7
	const url = new URL(
8
		`https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/issues/${issue_id}/`
9
	)
10

11
	const response = await fetch(url, {
12
		method: 'PUT',
13
		headers: {
14
			'Content-Type': 'application/json',
15
			Authorization: 'Bearer ' + auth.token
16
		},
17
		body: JSON.stringify(body)
18
	})
19
	if (!response.ok) {
20
		const text = await response.text()
21
		throw new Error(`${response.status} ${text}`)
22
	}
23
	return await response.json()
24
}
25

26
/* eslint-disable */
27
/**
28
 * This file was automatically generated by json-schema-to-typescript.
29
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
30
 * and run json-schema-to-typescript to regenerate this file.
31
 */
32

33
export interface Body {
34
	/**
35
	 * The new status for the issues. Valid values are `"resolved"`, `"resolvedInNextRelease"`, `"unresolved"`, and `"ignored"`.
36
	 */
37
	status?: string
38
	/**
39
	 * Additional details about the resolution. Supported values are `"inRelease"`, `"inNextRelease"`, `"inCommit"`, `"ignoreDuration"`, `"ignoreCount"`, `"ignoreWindow"`, `"ignoreUserCount"`, and `"ignoreUserWindow"`.
40
	 */
41
	statusDetails?: {
42
		/**
43
		 * Indicates if the issue is resolved in the next release based on the last seen release of that issue.
44
		 */
45
		inNextRelease?: boolean
46
		/**
47
		 * The version of the release in which the issue is resolved.
48
		 */
49
		inRelease?: string
50
		/**
51
		 * The commit hash in which the issue is resolved.
52
		 */
53
		inCommit?: string
54
		[k: string]: unknown
55
	}
56
	/**
57
	 * The actor id (or username) of the user or team that should be assigned to this issue.
58
	 */
59
	assignedTo?: string
60
	/**
61
	 * In case this API call is invoked with a user context this allows changing of the flag that indicates if the user has seen the event.
62
	 */
63
	hasSeen?: boolean
64
	/**
65
	 * In case this API call is invoked with a user context this allows changing of the bookmark flag.
66
	 */
67
	isBookmarked?: boolean
68
	/**
69
	 * In case this API call is invoked with a user context this allows the user to subscribe to workflow notications for this issue.
70
	 */
71
	isSubscribed?: boolean
72
	/**
73
	 * Sets the issue to public or private.
74
	 */
75
	isPublic?: boolean
76
	[k: string]: unknown
77
}
78