Skip to content

Remove hardcoded /api/v2/ prefixes from backend URLs (follow-up to #6938)#7046

Merged
ramyaragupathy merged 2 commits intodevelopfrom
pr-6938
Jan 2, 2026
Merged

Remove hardcoded /api/v2/ prefixes from backend URLs (follow-up to #6938)#7046
ramyaragupathy merged 2 commits intodevelopfrom
pr-6938

Conversation

@suzit-10
Copy link
Copy Markdown
Contributor

What type of PR is this? (check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation
  • 🧑‍💻 Refactor
  • ✅ Test
  • 🤖 Build or CI
  • ❓ Other (please specify)

Describe this PR

This PR cleans up redundant /api/v2/ prefixes across API endpoints, following up on #6938
contributed by @jake-low.

Background
In #6938, @jake-low removed hardcoded /api/v2 prefixes to support non-standard backend URLs. While that PR fixed the main issue, there were additional occurrences of /api/v2/ prefixes across the codebase. This PR rebases and extends their work, applying the cleanup consistently.

Technical Note
The URL constructor merges relative paths with the base URL automatically:

const url = new URL('/api/v1/', 'https://tasks.hotosm.org');
const newUrl = new URL('/api/v1/projects/', url);

console.log(newUrl.href);
// https://tasks.hotosm.org/api/v1/projects/

Even when both the base and relative path include /api/v1/, the final URL is correct.
This ensures that removing the redundant prefixes is safe, and no changes to fetchLocalJSONAPI() were required.

Changes

  • Removed all redundant /api/v2/ prefixes across the codebase.
  • Verified all API calls continue to work as expected.

Outcome

@sonarqubecloud
Copy link
Copy Markdown

@ramyaragupathy ramyaragupathy merged commit fd59d29 into develop Jan 2, 2026
9 checks passed
@ramyaragupathy ramyaragupathy mentioned this pull request Jan 15, 2026
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants