Skip to content

Route analytics endpoints to their correct hosts - #6

Merged
edumansky merged 1 commit into
mainfrom
fix/analytics-urls
Jul 29, 2026
Merged

Route analytics endpoints to their correct hosts#6
edumansky merged 1 commit into
mainfrom
fix/analytics-urls

Conversation

@edumansky

@edumansky edumansky commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Problem

webex calling reports-detailed-call-history get 404s: it was hitting
webexapis.com/v1/cdr_feed instead of analytics-calling.webexapis.com/v1/cdr_feed.
The Postman collections use {{baseUrl}} for every request, so the real host never
reaches api_spec.json and the generator stamped the collection default onto every
endpoint.

Same bug in admin analytics, which built webexapis.com/v1/v1/analytics/... — those
paths already carry /v1 and belong to analytics.webexapis.com.

Fix

  • codegen/generate_cli.py: BASE_URL_OVERRIDES (collection → path prefix → Go base
    URL expression), resolved per endpoint by longest matching prefix. New endpoints
    under those prefixes are covered automatically on the next make codegen.
  • internal/config: AnalyticsBaseURL plus AnalyticsCallingBaseURL(), which maps
    the data region to the documented FQDN (us/ca, eu/eun, in, au), defaulting to US.
  • --region global flag, resolved --region > WEBEX_REGION > config file, with
    webex config set region <r>; invalid values are rejected up front.
  • HTTP 451 (org data in another region) now yields an actionable error naming the
    endpoint from the response body and the flag to set.
  • Regenerated cmd/calling/reports_detailed_call_history.go and cmd/admin/analytics.go.

Verified against the live API

  • reports-detailed-call-history getanalytics-calling.webexapis.com/v1/cdr_feed, HTTP 200 with real CDRs.
  • --region eu → EU host, 451 → wrong data region (451): ... Webex says to use https://analytics-calling.webexapis.com — rerun with --region <us|ca|eu|eun|in|au>.
  • --region xx → rejected with the valid list.
  • admin analytics historical-data-related-messaging → correct host; returns a real 403 (no propack subscription) instead of a 404.

Known gap (not addressed)

--paginate on the CDR commands still uses the Calling start/max strategy, but CDR
paginates via the Link header with startTimeForNextFetch.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Detailed Call History (cdr_feed/cdr_stream) and the Admin analytics
reports are served from analytics hosts, not webexapis.com, so both
were 404ing. The Postman collections use {{baseUrl}} for every request,
so the real host is not in the source data — record it in a
BASE_URL_OVERRIDES table in generate_cli.py keyed by collection and
path prefix, applied per endpoint during codegen.

CDR hosts are region-specific, so add a --region flag (us, ca, eu, eun,
in, au) resolved from --region > WEBEX_REGION > config file, plus a
"webex config set region" key. An HTTP 451 now returns an actionable
error naming the endpoint Webex pointed us at.
@edumansky
edumansky merged commit 683bd88 into main Jul 29, 2026
2 checks passed
@edumansky
edumansky deleted the fix/analytics-urls branch July 29, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant