Skip to content

Commit a388306

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add new DeleteAssignee endpoint to Error Tracking APIs (#3404)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 6ae04cc commit a388306

10 files changed

+212
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61011,6 +61011,35 @@ paths:
6101161011
tags:
6101261012
- Error Tracking
6101361013
/api/v2/error-tracking/issues/{issue_id}/assignee:
61014+
delete:
61015+
description: Remove the assignee of an issue by `issue_id`.
61016+
operationId: DeleteIssueAssignee
61017+
parameters:
61018+
- $ref: '#/components/parameters/IssueIDPathParameter'
61019+
responses:
61020+
'204':
61021+
description: No Content
61022+
'400':
61023+
$ref: '#/components/responses/BadRequestResponse'
61024+
'401':
61025+
$ref: '#/components/responses/UnauthorizedResponse'
61026+
'403':
61027+
$ref: '#/components/responses/ForbiddenResponse'
61028+
'404':
61029+
$ref: '#/components/responses/NotFoundResponse'
61030+
'429':
61031+
$ref: '#/components/responses/TooManyRequestsResponse'
61032+
security:
61033+
- apiKeyAuth: []
61034+
appKeyAuth: []
61035+
- AuthZ:
61036+
- error_tracking_read
61037+
- error_tracking_write
61038+
- cases_read
61039+
- cases_write
61040+
summary: Remove the assignee of an issue
61041+
tags:
61042+
- Error Tracking
6101461043
put:
6101561044
description: Update the assignee of an issue by `issue_id`.
6101661045
operationId: UpdateIssueAssignee

api/datadogV2/api_error_tracking.go

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,74 @@ import (
1515
// ErrorTrackingApi service type
1616
type ErrorTrackingApi datadog.Service
1717

18+
// DeleteIssueAssignee Remove the assignee of an issue.
19+
// Remove the assignee of an issue by `issue_id`.
20+
func (a *ErrorTrackingApi) DeleteIssueAssignee(ctx _context.Context, issueId string) (*_nethttp.Response, error) {
21+
var (
22+
localVarHTTPMethod = _nethttp.MethodDelete
23+
localVarPostBody interface{}
24+
)
25+
26+
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ErrorTrackingApi.DeleteIssueAssignee")
27+
if err != nil {
28+
return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
29+
}
30+
31+
localVarPath := localBasePath + "/api/v2/error-tracking/issues/{issue_id}/assignee"
32+
localVarPath = datadog.ReplacePathParameter(localVarPath, "{issue_id}", _neturl.PathEscape(datadog.ParameterToString(issueId, "")))
33+
34+
localVarHeaderParams := make(map[string]string)
35+
localVarQueryParams := _neturl.Values{}
36+
localVarFormParams := _neturl.Values{}
37+
localVarHeaderParams["Accept"] = "*/*"
38+
39+
if a.Client.Cfg.DelegatedTokenConfig != nil {
40+
err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
41+
if err != nil {
42+
return nil, err
43+
}
44+
} else {
45+
datadog.SetAuthKeys(
46+
ctx,
47+
&localVarHeaderParams,
48+
[2]string{"apiKeyAuth", "DD-API-KEY"},
49+
[2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
50+
)
51+
}
52+
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
53+
if err != nil {
54+
return nil, err
55+
}
56+
57+
localVarHTTPResponse, err := a.Client.CallAPI(req)
58+
if err != nil || localVarHTTPResponse == nil {
59+
return localVarHTTPResponse, err
60+
}
61+
62+
localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
63+
if err != nil {
64+
return localVarHTTPResponse, err
65+
}
66+
67+
if localVarHTTPResponse.StatusCode >= 300 {
68+
newErr := datadog.GenericOpenAPIError{
69+
ErrorBody: localVarBody,
70+
ErrorMessage: localVarHTTPResponse.Status,
71+
}
72+
if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 {
73+
var v APIErrorResponse
74+
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
75+
if err != nil {
76+
return localVarHTTPResponse, newErr
77+
}
78+
newErr.ErrorModel = v
79+
}
80+
return localVarHTTPResponse, newErr
81+
}
82+
83+
return localVarHTTPResponse, nil
84+
}
85+
1886
// GetIssueOptionalParameters holds optional parameters for GetIssue.
1987
type GetIssueOptionalParameters struct {
2088
Include *[]GetIssueIncludeQueryParameterItem

api/datadogV2/doc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@
226226
// - [DowntimesApi.ListDowntimes]
227227
// - [DowntimesApi.ListMonitorDowntimes]
228228
// - [DowntimesApi.UpdateDowntime]
229+
// - [ErrorTrackingApi.DeleteIssueAssignee]
229230
// - [ErrorTrackingApi.GetIssue]
230231
// - [ErrorTrackingApi.SearchIssues]
231232
// - [ErrorTrackingApi.UpdateIssueAssignee]
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Remove the assignee of an issue returns "No Content" response
2+
3+
package main
4+
5+
import (
6+
"context"
7+
"fmt"
8+
"os"
9+
10+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
11+
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
12+
)
13+
14+
func main() {
15+
// there is a valid "issue" in the system
16+
IssueID := os.Getenv("ISSUE_ID")
17+
18+
ctx := datadog.NewDefaultContext(context.Background())
19+
configuration := datadog.NewConfiguration()
20+
apiClient := datadog.NewAPIClient(configuration)
21+
api := datadogV2.NewErrorTrackingApi(apiClient)
22+
r, err := api.DeleteIssueAssignee(ctx, IssueID)
23+
24+
if err != nil {
25+
fmt.Fprintf(os.Stderr, "Error when calling `ErrorTrackingApi.DeleteIssueAssignee`: %v\n", err)
26+
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-10-17T14:43:40.022Z
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
interactions:
2+
- request:
3+
body: |
4+
{"data":{"attributes":{"from":1759416220000,"query":"service:synthetics-browser","to":1760712220000,"track":"rum"},"type":"search_request"}}
5+
form: {}
6+
headers:
7+
Accept:
8+
- application/json
9+
Content-Type:
10+
- application/json
11+
id: 0
12+
method: POST
13+
url: https://api.datadoghq.com/api/v2/error-tracking/issues/search
14+
response:
15+
body: '{"data":[{"id":"d3ab59c6-84ee-11f0-87bb-da7ad0900002","type":"error_tracking_search_result","attributes":{"impacted_sessions":4316,"total_count":8640},"relationships":{"issue":{"data":{"id":"d3ab59c6-84ee-11f0-87bb-da7ad0900002","type":"issue"}}}},{"id":"a5bb2896-a4d0-11f0-bd76-da7ad0900002","type":"error_tracking_search_result","attributes":{"impacted_sessions":280,"total_count":272},"relationships":{"issue":{"data":{"id":"a5bb2896-a4d0-11f0-bd76-da7ad0900002","type":"issue"}}}},{"id":"e2a89d14-6f07-11f0-8a88-da7ad0900002","type":"error_tracking_search_result","attributes":{"impacted_sessions":1,"total_count":4},"relationships":{"issue":{"data":{"id":"e2a89d14-6f07-11f0-8a88-da7ad0900002","type":"issue"}}}},{"id":"5f8ebd5c-6dd9-11f0-8a28-da7ad0900002","type":"error_tracking_search_result","attributes":{"impacted_sessions":1,"total_count":1},"relationships":{"issue":{"data":{"id":"5f8ebd5c-6dd9-11f0-8a28-da7ad0900002","type":"issue"}}}},{"id":"e2a89134-6f07-11f0-8d36-da7ad0900002","type":"error_tracking_search_result","attributes":{"impacted_sessions":1,"total_count":1},"relationships":{"issue":{"data":{"id":"e2a89134-6f07-11f0-8d36-da7ad0900002","type":"issue"}}}}]}'
16+
code: 200
17+
duration: 0ms
18+
headers:
19+
Content-Type:
20+
- application/vnd.api+json
21+
status: 200 OK
22+
- request:
23+
body: ''
24+
form: {}
25+
headers:
26+
Accept:
27+
- '*/*'
28+
id: 1
29+
method: DELETE
30+
url: https://api.datadoghq.com/api/v2/error-tracking/issues/d3ab59c6-84ee-11f0-87bb-da7ad0900002/assignee
31+
response:
32+
body: ''
33+
code: 204
34+
duration: 0ms
35+
headers: {}
36+
status: 204 No Content
37+
version: 2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-10-17T14:43:41.755Z
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
interactions:
2+
- request:
3+
body: ''
4+
form: {}
5+
headers:
6+
Accept:
7+
- '*/*'
8+
id: 0
9+
method: DELETE
10+
url: https://api.datadoghq.com/api/v2/error-tracking/issues/67d80aa3-36ff-44b9-a694-c501a7591737/assignee
11+
response:
12+
body: '{"errors":[{"status":"404","title":"Not Found","detail":"issue not found"}]}'
13+
code: 404
14+
duration: 0ms
15+
headers:
16+
Content-Type:
17+
- application/vnd.api+json
18+
status: 404 Not Found
19+
version: 2

tests/scenarios/features/v2/error_tracking.feature

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,28 @@ Feature: Error Tracking
3232
Then the response status is 200 OK
3333
And the response "data.id" is equal to "{{ issue.id }}"
3434

35+
@generated @skip @team:DataDog/error-tracking
36+
Scenario: Remove the assignee of an issue returns "Bad Request" response
37+
Given new "DeleteIssueAssignee" request
38+
And request contains "issue_id" parameter from "REPLACE.ME"
39+
When the request is sent
40+
Then the response status is 400 Bad Request
41+
42+
@team:DataDog/error-tracking
43+
Scenario: Remove the assignee of an issue returns "No Content" response
44+
Given new "DeleteIssueAssignee" request
45+
And there is a valid "issue" in the system
46+
And request contains "issue_id" parameter from "issue.id"
47+
When the request is sent
48+
Then the response status is 204 No Content
49+
50+
@team:DataDog/error-tracking
51+
Scenario: Remove the assignee of an issue returns "Not Found" response
52+
Given new "DeleteIssueAssignee" request
53+
And request contains "issue_id" parameter with value "67d80aa3-36ff-44b9-a694-c501a7591737"
54+
When the request is sent
55+
Then the response status is 404 Not Found
56+
3557
@team:DataDog/error-tracking
3658
Scenario: Search error tracking issues returns "Bad Request" response
3759
Given new "SearchIssues" request

tests/scenarios/features/v2/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,12 @@
13191319
"type": "safe"
13201320
}
13211321
},
1322+
"DeleteIssueAssignee": {
1323+
"tag": "Error Tracking",
1324+
"undo": {
1325+
"type": "idempotent"
1326+
}
1327+
},
13221328
"UpdateIssueAssignee": {
13231329
"tag": "Error Tracking",
13241330
"undo": {

0 commit comments

Comments
 (0)