feat(api): Use region-specific URLs in API doc curl examples#17779
feat(api): Use region-specific URLs in API doc curl examples#17779mwarkentin wants to merge 5 commits into
Conversation
Read the global `servers` field from the OpenAPI spec instead of
hardcoding `sentry.io` as the base URL for curl examples. The spec
defines `https://{region}.sentry.io` with region enum (us, de), so
curl examples now render as `https://us.sentry.io/api/0/...` with a
region picker (US | DE tabs) above the code block.
For logged-in users, the region is auto-detected from their
CodeContext project data so the correct regional endpoint is
pre-selected.
Refs INC-2335
Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Satisfy CodeQL js/regex/missing-regexp-anchor by requiring a `/` after `.sentry.io` so the pattern cannot match lookalike domains. Co-Authored-By: Claude <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Fixes react-hooks/exhaustive-deps lint error where the fallback empty array created a new reference on every render. Co-Authored-By: Claude <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b2ecd86. Configure here.
Read sharedKeywordSelection to resolve the user's currently selected project instead of always reading PROJECT[0]. This ensures the region tab matches when users switch between projects in different regions. Co-Authored-By: Claude <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Just thinking out loud, would it make more sense to have it be 2 separate code tabs in the snippet vs additional tabs above? @mwarkentin |
|
@sergical do you mean tabs where we have "bash"? Or underneath that? |
yeah where it says Bash. I am not sure if we can create those programmatically but feels like something that can be done? |
|
@sergical seems like that would get a bit weird - would we have a us and de tab for each language that we support? Seems like a different "level" of hierarchy compared to language. Edit: Note that this will get worse as new localities are added in the future. |
I was thinking since it's for api docs, there isn't anything language specific and it's just curl commands with different urls. maybe the right approach is on API routes to have a region dropdown where on SDK pages we have the SDK dropdown? Sorry, im just trying to figure out a way to have existing patterns serve the need. since most of the time a user looking at docs will only care about 1 config for the region vs each code block example, thoughts? |





DESCRIBE YOUR PR
API doc pages (e.g.
/api/explore/query-explore-events-in-table-format/) currently render curl examples withhttps://sentry.io/api/0/...as the base URL. This ignores the OpenAPI spec'sserversfield which defines region-specific URLs (https://{region}.sentry.io).This PR:
serversfield from the OpenAPI spec instead of hardcodingsentry.io. Per-operation server overrides are still respected first, then the global servers block, thenhttps://sentry.ioas a safety fallback.https://us.sentry.io/api/0/...andhttps://de.sentry.io/api/0/....API_URLfromCodeContext, pre-selecting the correct tab.This steers customers (especially those on the DE region) toward the correct regional endpoint, avoiding cross-Atlantic RPCs.
Refs INC-2335
IS YOUR CHANGE URGENT?
PRE-MERGE CHECKLIST
Made with Cursor