Skip to content

Commit 5d320d2

Browse files
authored
feat(api-idorslug): Updated Subset of Replay Endpoints and API Docs Tests to use organization_id_or_slug (#70711)
A subset of changes from #70081!
1 parent 1a49bec commit 5d320d2

File tree

59 files changed

+416
-273
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+416
-273
lines changed

src/sentry/api/urls.py

+49-49
Large diffs are not rendered by default.

src/sentry/feedback/blueprints/api.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ returns a response _will_ document the full interchange format. Clients may opt
1414
to restrict response data or provide a subset of the request data. The API may
1515
or may not accept partial payloads.
1616

17-
## Feedback Index [/organizations/<organization_slug>/feedback/]
17+
## Feedback Index [/organizations/<organization_id_or_slug>/feedback/]
1818

1919
- Parameters
2020

@@ -155,7 +155,7 @@ Retrieve a collection of feedback items.
155155
}
156156
```
157157
158-
## Feedback [/projects/<organization_slug>/<project_id_or_slug>/feedback/<feedback_id>/]
158+
## Feedback [/projects/<organization_id_or_slug>/<project_id_or_slug>/feedback/<feedback_id>/]
159159
160160
- Model
161161

src/sentry/incidents/endpoints/organization_alert_rule_details.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def wrapper(self, request: Request, organization, alert_rule):
335335

336336
@extend_schema(
337337
operation_id="Retrieve a Metric Alert Rule for an Organization",
338-
parameters=[GlobalParams.ORG_SLUG, MetricAlertParams.METRIC_RULE_ID],
338+
parameters=[GlobalParams.ORG_ID_OR_SLUG, MetricAlertParams.METRIC_RULE_ID],
339339
responses={
340340
200: AlertRuleSerializer,
341341
401: RESPONSE_UNAUTHORIZED,
@@ -360,7 +360,7 @@ def get(self, request: Request, organization, alert_rule) -> Response:
360360

361361
@extend_schema(
362362
operation_id="Update a Metric Alert Rule",
363-
parameters=[GlobalParams.ORG_SLUG, MetricAlertParams.METRIC_RULE_ID],
363+
parameters=[GlobalParams.ORG_ID_OR_SLUG, MetricAlertParams.METRIC_RULE_ID],
364364
request=OrganizationAlertRuleDetailsPutSerializer,
365365
responses={
366366
200: AlertRuleSerializer,
@@ -391,7 +391,7 @@ def put(self, request: Request, organization, alert_rule) -> Response:
391391

392392
@extend_schema(
393393
operation_id="Delete a Metric Alert Rule",
394-
parameters=[GlobalParams.ORG_SLUG, MetricAlertParams.METRIC_RULE_ID],
394+
parameters=[GlobalParams.ORG_ID_OR_SLUG, MetricAlertParams.METRIC_RULE_ID],
395395
responses={
396396
202: RESPONSE_ACCEPTED,
397397
401: RESPONSE_UNAUTHORIZED,

src/sentry/replays/blueprints/api.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Host: https://sentry.io/api/0
1111

1212
This document is structured by resource with each resource having actions that can be performed against it. Every action that either accepts a request or returns a response WILL document the full interchange format. Clients may opt to restrict response data or provide a subset of the request data. The API may or may not accept partial payloads.
1313

14-
## Replays [/organizations/<organization_slug>/replays/]
14+
## Replays [/organizations/<organization_id_or_slug>/replays/]
1515

1616
- Parameters
1717

@@ -173,7 +173,7 @@ Retrieve a collection of replays.
173173
}
174174
```
175175

176-
## Replay [/projects/<organization_slug>/<project_id_or_slug>/replays/<replay_id>/]
176+
## Replay [/projects/<organization_id_or_slug>/<project_id_or_slug>/replays/<replay_id>/]
177177

178178
- Parameters
179179
- field (optional, string)
@@ -244,7 +244,7 @@ Deletes a replay instance.
244244

245245
- Response 204
246246

247-
## Replay Accessibility Issues [/projects/<organization_slug>/<project_id_or_slug>/replays/<replay_id>/accessibility-issues]
247+
## Replay Accessibility Issues [/projects/<organization_id_or_slug>/<project_id_or_slug>/replays/<replay_id>/accessibility-issues]
248248

249249
This resource does not accept any URI parameters and is not paginated. Responses are ingested whole.
250250

@@ -336,7 +336,7 @@ IssueElementAlternative Type:
336336
}
337337
```
338338

339-
## Replay Selectors [/organizations/<organization_slug>/replay-selectors/]
339+
## Replay Selectors [/organizations/<organization_id_or_slug>/replay-selectors/]
340340

341341
- Parameters
342342

@@ -411,7 +411,7 @@ Retrieve a collection of selectors.
411411
}
412412
```
413413

414-
## Replay Recording Segments [/projects/<organization_slug>/<project_id_or_slug>/replays/<replay_id>/recording-segments/]
414+
## Replay Recording Segments [/projects/<organization_id_or_slug>/<project_id_or_slug>/replays/<replay_id>/recording-segments/]
415415

416416
- Parameters
417417
- per_page
@@ -463,7 +463,7 @@ With download query argument, rrweb events JSON
463463
]
464464
```
465465

466-
## Replay Recording Segment [/projects/<organization_slug>/<project_id_or_slug>/replays/<replay_id>/recording-segments/<segment_id>/]
466+
## Replay Recording Segment [/projects/<organization_id_or_slug>/<project_id_or_slug>/replays/<replay_id>/recording-segments/<segment_id>/]
467467

468468
- Parameters
469469
- download - Instruct the API to return a streaming bytes response.
@@ -493,7 +493,7 @@ With download query argument.
493493

494494
Content-Type application/octet-stream
495495

496-
## Replay Video [/projects/<organization_slug>/<project_id_or_slug>/replays/<replay_id>/videos/<segment_id>/]
496+
## Replay Video [/projects/<organization_id_or_slug>/<project_id_or_slug>/replays/<replay_id>/videos/<segment_id>/]
497497

498498
### Fetch Replay Video [GET]
499499

@@ -505,7 +505,7 @@ Returns the bytes of a replay-segment video.
505505
\x00\x00\x00
506506
```
507507

508-
## Replay Tag Keys [/projects/<organization_slug>/<project_id_or_slug>/replays/tags/]
508+
## Replay Tag Keys [/projects/<organization_id_or_slug>/<project_id_or_slug>/replays/tags/]
509509

510510
### Fetch Tag Keys [GET]
511511

@@ -529,7 +529,7 @@ Retrieve a collection of tag keys associated with the replays dataset.
529529
]
530530
```
531531

532-
## Replay Tag Values [/projects/<organization_slug>/<project_id_or_slug>/replays/tags/<key>/values/]
532+
## Replay Tag Values [/projects/<organization_id_or_slug>/<project_id_or_slug>/replays/tags/<key>/values/]
533533

534534
### Fetch Tag Values [GET]
535535

@@ -559,7 +559,7 @@ Retrieve a collection of tag values associated with a tag key on the replays dat
559559
]
560560
```
561561

562-
## Replay Click [/projects/<organization_slug>/<project_id_or_slug>/replays/<replay_id>/clicks/]
562+
## Replay Click [/projects/<organization_id_or_slug>/<project_id_or_slug>/replays/<replay_id>/clicks/]
563563

564564
Parameters:
565565

@@ -614,7 +614,7 @@ Retrieve a collection of click events associated with a replay.
614614
}
615615
```
616616

617-
## Replay Viewed By [/projects/<organization_slug>/<project_id_or_slug>/replays/<replay_id>/viewed-by/]
617+
## Replay Viewed By [/projects/<organization_id_or_slug>/<project_id_or_slug>/replays/<replay_id>/viewed-by/]
618618

619619
### Fetch Replay Viewed By [GET]
620620

src/sentry/replays/endpoints/organization_replay_count.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class OrganizationReplayCountEndpoint(OrganizationEventsV2EndpointBase):
6060
parameters=[
6161
GlobalParams.END,
6262
GlobalParams.ENVIRONMENT,
63-
GlobalParams.ORG_SLUG,
63+
GlobalParams.ORG_ID_OR_SLUG,
6464
GlobalParams.START,
6565
GlobalParams.STATS_PERIOD,
6666
OrganizationParams.PROJECT,

src/sentry/replays/endpoints/organization_replay_details.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class OrganizationReplayDetailsEndpoint(OrganizationEndpoint):
3636

3737
@extend_schema(
3838
operation_id="Retrieve a Replay Instance",
39-
parameters=[GlobalParams.ORG_SLUG, ReplayParams.REPLAY_ID, ReplayValidator],
39+
parameters=[GlobalParams.ORG_ID_OR_SLUG, ReplayParams.REPLAY_ID, ReplayValidator],
4040
responses={
4141
200: inline_sentry_response_serializer("GetReplay", ReplayDetailsResponse),
4242
400: RESPONSE_BAD_REQUEST,

src/sentry/replays/endpoints/organization_replay_index.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class OrganizationReplayIndexEndpoint(OrganizationEndpoint):
3434

3535
@extend_schema(
3636
operation_id="List an Organization's Replays",
37-
parameters=[GlobalParams.ORG_SLUG, ReplayValidator],
37+
parameters=[GlobalParams.ORG_ID_OR_SLUG, ReplayValidator],
3838
responses={
3939
200: inline_sentry_response_serializer("ListReplays", list[ReplayDetailsResponse]),
4040
400: RESPONSE_BAD_REQUEST,

src/sentry/replays/endpoints/organization_replay_selector_index.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def get_replay_filter_params(self, request, organization):
9595
@extend_schema(
9696
operation_id="List an Organization's Selectors",
9797
parameters=[
98-
GlobalParams.ORG_SLUG,
98+
GlobalParams.ORG_ID_OR_SLUG,
9999
GlobalParams.ENVIRONMENT,
100100
ReplaySelectorValidator,
101101
CursorQueryParam,

src/sentry/replays/endpoints/project_replay_clicks_index.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class ProjectReplayClicksIndexEndpoint(ProjectEndpoint):
6868
operation_id="List Clicked Nodes",
6969
parameters=[
7070
CursorQueryParam,
71-
GlobalParams.ORG_SLUG,
71+
GlobalParams.ORG_ID_OR_SLUG,
7272
GlobalParams.PROJECT_ID_OR_SLUG,
7373
GlobalParams.ENVIRONMENT,
7474
ReplayParams.REPLAY_ID,

src/sentry/replays/endpoints/project_replay_details.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def get(self, request: Request, project: Project, replay_id: str) -> Response:
7373
@extend_schema(
7474
operation_id="Delete a Replay Instance",
7575
parameters=[
76-
GlobalParams.ORG_SLUG,
76+
GlobalParams.ORG_ID_OR_SLUG,
7777
GlobalParams.PROJECT_ID_OR_SLUG,
7878
ReplayParams.REPLAY_ID,
7979
],

src/sentry/replays/endpoints/project_replay_recording_segment_details.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class ProjectReplayRecordingSegmentDetailsEndpoint(ProjectEndpoint):
3434
@extend_schema(
3535
operation_id="Fetch Recording Segment",
3636
parameters=[
37-
GlobalParams.ORG_SLUG,
37+
GlobalParams.ORG_ID_OR_SLUG,
3838
GlobalParams.PROJECT_ID_OR_SLUG,
3939
ReplayParams.REPLAY_ID,
4040
ReplayParams.SEGMENT_ID,

src/sentry/replays/endpoints/project_replay_recording_segment_index.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __init__(self, **options) -> None:
3636
operation_id="List Recording Segments",
3737
parameters=[
3838
CursorQueryParam,
39-
GlobalParams.ORG_SLUG,
39+
GlobalParams.ORG_ID_OR_SLUG,
4040
GlobalParams.PROJECT_ID_OR_SLUG,
4141
ReplayParams.REPLAY_ID,
4242
VisibilityParams.PER_PAGE,

src/sentry/replays/endpoints/project_replay_video_details.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ProjectReplayVideoDetailsEndpoint(ProjectEndpoint):
4141
@extend_schema(
4242
operation_id="Fetch Replay Video",
4343
parameters=[
44-
GlobalParams.ORG_SLUG,
44+
GlobalParams.ORG_ID_OR_SLUG,
4545
GlobalParams.PROJECT_ID_OR_SLUG,
4646
ReplayParams.REPLAY_ID,
4747
ReplayParams.SEGMENT_ID,

src/sentry/replays/endpoints/project_replay_viewed_by.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ProjectReplayViewedByEndpoint(ProjectEndpoint):
4141
@extend_schema(
4242
operation_id="Get list of user who have viewed a replay",
4343
parameters=[
44-
GlobalParams.ORG_SLUG,
44+
GlobalParams.ORG_ID_OR_SLUG,
4545
GlobalParams.PROJECT_ID_OR_SLUG,
4646
ReplayParams.REPLAY_ID,
4747
],

src/sentry/testutils/cases.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -857,13 +857,15 @@ def enable_org_2fa(self, organization):
857857
def api_enable_org_2fa(self, organization, user):
858858
self.login_as(user)
859859
url = reverse(
860-
"sentry-api-0-organization-details", kwargs={"organization_slug": organization.slug}
860+
"sentry-api-0-organization-details",
861+
kwargs={"organization_id_or_slug": organization.slug},
861862
)
862863
return self.client.put(url, data={"require2FA": True})
863864

864865
def api_disable_org_2fa(self, organization, user):
865866
url = reverse(
866-
"sentry-api-0-organization-details", kwargs={"organization_slug": organization.slug}
867+
"sentry-api-0-organization-details",
868+
kwargs={"organization_id_or_slug": organization.slug},
867869
)
868870
return self.client.put(url, data={"require2FA": False})
869871

@@ -1193,7 +1195,10 @@ def setUp(self):
11931195

11941196
self.init_path = reverse(
11951197
"sentry-organization-integrations-setup",
1196-
kwargs={"organization_slug": self.organization.slug, "provider_id": self.provider.key},
1198+
kwargs={
1199+
"organization_slug": self.organization.slug,
1200+
"provider_id": self.provider.key,
1201+
},
11971202
)
11981203

11991204
self.setup_path = reverse(

tests/apidocs/endpoints/events/test_project_event_details.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def setUp(self):
1717
self.url = reverse(
1818
self.endpoint,
1919
kwargs={
20-
"organization_slug": self.project.organization.slug,
20+
"organization_id_or_slug": self.project.organization.slug,
2121
"project_id_or_slug": self.project.slug,
2222
"event_id": event.event_id,
2323
},

tests/apidocs/endpoints/events/test_project_tagkey_values.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def setUp(self):
1414
self.url = reverse(
1515
"sentry-api-0-project-tagkey-values",
1616
kwargs={
17-
"organization_slug": self.organization.slug,
17+
"organization_id_or_slug": self.organization.slug,
1818
"project_id_or_slug": self.project.slug,
1919
"key": key,
2020
},

tests/apidocs/endpoints/organizations/test_event_id_lookup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def setUp(self):
99
event = self.create_event("a", message="oh no")
1010
self.url = reverse(
1111
"sentry-api-0-event-id-lookup",
12-
kwargs={"organization_slug": self.organization.slug, "event_id": event.event_id},
12+
kwargs={"organization_id_or_slug": self.organization.slug, "event_id": event.event_id},
1313
)
1414

1515
self.login_as(user=self.user)

tests/apidocs/endpoints/organizations/test_org_details.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def setUp(self):
1010

1111
self.url = reverse(
1212
"sentry-api-0-organization-details",
13-
kwargs={"organization_slug": organization.slug},
13+
kwargs={"organization_id_or_slug": organization.slug},
1414
)
1515

1616
self.login_as(user=self.user)

tests/apidocs/endpoints/organizations/test_org_repos.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def setUp(self):
1212

1313
self.url = reverse(
1414
"sentry-api-0-organization-repositories",
15-
kwargs={"organization_slug": organization.slug},
15+
kwargs={"organization_id_or_slug": organization.slug},
1616
)
1717

1818
self.login_as(user=self.user)

tests/apidocs/endpoints/organizations/test_repo_commits.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def setUp(self):
1414

1515
self.url = reverse(
1616
"sentry-api-0-organization-repository-commits",
17-
kwargs={"organization_slug": organization.slug, "repo_id": repo.id},
17+
kwargs={"organization_id_or_slug": organization.slug, "repo_id": repo.id},
1818
)
1919

2020
self.login_as(user=self.user)

tests/apidocs/endpoints/organizations/test_shortid.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def setUp(self):
1111
self.url = reverse(
1212
"sentry-api-0-short-id-lookup",
1313
kwargs={
14-
"organization_slug": self.organization.slug,
14+
"organization_id_or_slug": self.organization.slug,
1515
"short_id": group.qualified_short_id,
1616
},
1717
)

tests/apidocs/endpoints/projects/test_project_stats.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def setUp(self):
1212
self.url = reverse(
1313
"sentry-api-0-project-stats",
1414
kwargs={
15-
"organization_slug": self.organization.slug,
15+
"organization_id_or_slug": self.organization.slug,
1616
"project_id_or_slug": self.project.slug,
1717
},
1818
)

tests/apidocs/endpoints/projects/test_service_hook_details.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def setUp(self):
1111
self.url = reverse(
1212
"sentry-api-0-project-service-hook-details",
1313
kwargs={
14-
"organization_slug": self.organization.slug,
14+
"organization_id_or_slug": self.organization.slug,
1515
"project_id_or_slug": self.project.slug,
1616
"hook_id": hook.guid,
1717
},

tests/apidocs/endpoints/projects/test_service_hooks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def setUp(self):
1212
self.url = reverse(
1313
"sentry-api-0-service-hooks",
1414
kwargs={
15-
"organization_slug": self.organization.slug,
15+
"organization_id_or_slug": self.organization.slug,
1616
"project_id_or_slug": self.project.slug,
1717
},
1818
)

tests/apidocs/endpoints/projects/test_tag_values.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def setUp(self):
1212
self.url = reverse(
1313
"sentry-api-0-project-tagkey-values",
1414
kwargs={
15-
"organization_slug": self.organization.slug,
15+
"organization_id_or_slug": self.organization.slug,
1616
"project_id_or_slug": self.project.slug,
1717
"key": key,
1818
},

tests/apidocs/endpoints/projects/test_users.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def setUp(self):
1818
self.url = reverse(
1919
"sentry-api-0-project-users",
2020
kwargs={
21-
"organization_slug": self.organization.slug,
21+
"organization_id_or_slug": self.organization.slug,
2222
"project_id_or_slug": self.project.slug,
2323
},
2424
)

tests/apidocs/endpoints/releases/test_deploys.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ def setUp(self):
4848

4949
self.url = reverse(
5050
"sentry-api-0-organization-release-deploys",
51-
kwargs={"organization_slug": project.organization.slug, "version": release.version},
51+
kwargs={
52+
"organization_id_or_slug": project.organization.slug,
53+
"version": release.version,
54+
},
5255
)
5356

5457
self.login_as(user=self.user)

tests/apidocs/endpoints/releases/test_organization_release_commit_files.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ def setUp(self):
3636
)
3737
self.url = reverse(
3838
"sentry-api-0-release-commitfilechange",
39-
kwargs={"organization_slug": project.organization.slug, "version": release.version},
39+
kwargs={
40+
"organization_id_or_slug": project.organization.slug,
41+
"version": release.version,
42+
},
4043
)
4144

4245
self.login_as(user=self.user)

0 commit comments

Comments
 (0)