Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API overhaul: add version prefix v1 to the API endpoints #238

Closed
Tracked by #141
josecelano opened this issue Mar 12, 2023 · 1 comment · Fixed by #239
Closed
Tracked by #141

API overhaul: add version prefix v1 to the API endpoints #238

josecelano opened this issue Mar 12, 2023 · 1 comment · Fixed by #239

Comments

@josecelano
Copy link
Member

josecelano commented Mar 12, 2023

Parent issue: #141

Add a URL prefix to all API urls:

Current URLs:

  • /api/key/:seconds_valid_or_key
  • /api/keys/reload
  • /api/stats
  • /api/torrent/:info_hash
  • /api/torrents
  • /api/whitelist/:info_hash
  • /api/whitelist/reload

New URLs:

  • /api/v1/key/:seconds_valid_or_key
  • /api/v1/keys/reload
  • /api/v1/stats
  • /api/v1/torrent/:info_hash
  • /api/v1/api/torrents
  • /api/v1/whitelist/:info_hash
  • /api/v1/whitelist/reload

We will keep the current ones (without prefixes) until we update the torrust index backend.

@josecelano josecelano mentioned this issue Mar 12, 2023
4 tasks
@josecelano josecelano changed the title API overhaul: add version prefix to the API urls v1 API overhaul: add version prefix v1 to the API urls Mar 12, 2023
@josecelano josecelano changed the title API overhaul: add version prefix v1 to the API urls API overhaul: add version prefix v1 to the API endpoints Mar 12, 2023
@josecelano
Copy link
Member Author

We know that using a hardcoded API version on the URL is not a good practice because it forces you to rewrite all URLs when you want to upgrade the API client.

This is a temporary change that will allow us in the future to implement a new API without affecting current consumers. The current consumers only have to add the prefix now to continue using the API instead of changing their request to include a version value in the header, which is our preferred way to implement versioning in the new major API change.

See GitHub API versioning for an example of how to implement API versions.

cc @da2ce7 @WarmBeer

@josecelano josecelano linked a pull request Mar 12, 2023 that will close this issue
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Mar 12, 2023
josecelano added a commit that referenced this issue Mar 12, 2023
7f4479a refactor(tests): one binary (Jose Celano)
d9a4266 feat(api): [#238] API also served with version prefix /api/v1/ (Jose Celano)
70d94ad refactor(api): add namespace v1 to API (Jose Celano)

Pull request description:

Top commit has no ACKs.

Tree-SHA512: 8a7a2a788c1f49b73e78cda2cb5938a1a8e3ab6b1e41a591cbb2979e9e148f12e29b8fe657c830258254b61c2d67efb58def698e3153cb8b5953afca15200fb0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant