#2560

feat(cli): accept App Store Connect self-link URLs as resource IDs

Openrudrankriyamopened 1mo ago

Summary

Resource-ID flags (--build-id, --version-id, --app, --submission-id, --id, ...) should accept the App Store Connect API self-link of the resource in addition to the bare ID, extracting the ID from https://api.appstoreconnect.apple.com/vN/<type>/<id>.

Motivation

Every asc ... --output json read prints Apple's envelope unmodified, so each resource carries a links.self URL. Webhook deliveries carry the same URLs. Other tooling already accepts them: EAS CLI accepts https://api.appstoreconnect.apple.com/v1/betaFeedbackCrashSubmissions/<id> for eas testflight:feedback (https://github.com/expo/eas-cli/pull/4084). Accepting the same shape lets a links.self value or a webhook payload URL pipe straight into asc without a jq/sed step to strip the prefix, and keeps parity for agents that copy the link out of a payload.

Current behavior

asc builds info --build-id https://api.appstoreconnect.apple.com/v1/builds/2f1a3c4d

sends the whole URL as the ID segment and Apple returns a 404 / bad-path error.

Proposed contract

  • A shared normalizer in internal/cli/shared: a value that parses as a URL with host api.appstoreconnect.apple.com and path exactly /vN/<type>/<id> yields <id>.
  • Any longer path (for example /relationships/... or a related-resource path) is a usage error (exit 2).
  • When the flag's expected type is known (--build-id -> builds), a URL of another type is a usage error naming both types.
  • Bare IDs pass through unchanged; bundle identifier strings on --bundle-id / product IDs / names keep working.
  • Wired into: --build-id, --version-id, --app (type apps, including ASC_APP_ID), --submission-id (testflight feedback/crashes), --id/--group on testflight groups, --localization-id, --info-id, --id on subscriptions / IAP, --bundle / --id on bundle-ids.
  • No new command, flag, or output change.

Acceptance criteria

  • Unit tests for the normalizer: valid link, wrong type, longer path, other host, bare ID, empty value, bundle identifier passthrough.
  • cmdtest coverage on at least three commands with a stub transport asserting the request path uses the extracted ID, plus a wrong-type rejection that exits 2 before authentication or any request.
  • Note in concepts/output-formats.mdx (or the automation guide) and docs/design/self-link-ids.md.
  • Existing bare-ID behavior and help text unchanged.

Activity

0

No activity yet.