Skip to content

Fix: Expose endpoint with version/hash#1434

Open
gabrnavarro wants to merge 1 commit intoPokeAPI:masterfrom
gabrnavarro:bot/task-93-issue-1432
Open

Fix: Expose endpoint with version/hash#1434
gabrnavarro wants to merge 1 commit intoPokeAPI:masterfrom
gabrnavarro:bot/task-93-issue-1432

Conversation

@gabrnavarro
Copy link

What changed

Added a new GET /api/v2/meta endpoint that returns metadata about the currently deployed version of the API:

{
  "deploy_date": "2024-01-15T12:34:56+00:00",
  "hash": "abc123def456...",
  "tag": "2.7.0"
}
  • deploy_date: ISO 8601 timestamp of the latest git commit (null if unavailable)
  • hash: Full git commit hash (null if unavailable)
  • tag: Git tag pointing at HEAD, if any (null if not tagged or unavailable)

Why

Exposes version/hash information useful for cache invalidation — clients can check the hash field to determine whether to flush their cache after a new deploy.

Fixes #1432

Testing

  • Added test_meta_api to pokemon_v2/tests.py verifying the endpoint returns HTTP 200 with the expected deploy_date, hash, and tag fields.
  • Ran existing tests (test_gender_api, test_language_api, test_meta_api) — all pass.

@Naramsim
Copy link
Member

Hi! Thanks for the quick implementation! I'd like to discuss here even with other people the exposed properties.

Do @jemarq04 @PraaneshSelvaraj have any opinions on this?

@phalt
Copy link
Member

phalt commented Mar 10, 2026

Does this get translated through Ditto to the production environment?

@Naramsim
Copy link
Member

Yes, it would be an endpoint listed here: https://pokeapi.co/api/v2/

def test_meta_api(self):
response = self.client.get("{}/meta".format(API_V2))
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertIn("deploy_date", response.data)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests will always pass, because it is looking for the key, which is always there.

@jemarq04
Copy link
Contributor

Yes, it would be an endpoint listed here: https://pokeapi.co/api/v2/

I think this would be great to provide in the API! I did a local test build and I don't actually see the 'meta' endpoint at the local version of https://pokeapi.co/api/v2/. Is this expected with how Ditto works? I'm not familiar with how this tool is used in the framework. Navigating to /api/v2/meta does provide the expected response.

@Naramsim
Copy link
Member

Naramsim commented Mar 10, 2026

I expected it to be listed on the root endpoint. We need it to be listed there for Ditto

Probably a change is needed for pokemon_v2/urls.py

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.

Expose endpoint with version/hash

4 participants