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

Update project params in API to support both slugs and IDs #88776

Open
dcramer opened this issue Apr 4, 2025 · 0 comments
Open

Update project params in API to support both slugs and IDs #88776

dcramer opened this issue Apr 4, 2025 · 0 comments

Comments

@dcramer
Copy link
Member

dcramer commented Apr 4, 2025

Theres a bunch of places where we are only supporting numeric project IDs in endpoints. For example, on the organization_events endpoint. Every place that we accept a numeric project ID, assuming an organization is available (which should be 100% of the time), we need to also accept a project slug for the same value. You can see how this is done in the api/bases/project.py.

You can grep on OrganizationParams.PROJECT to get a sense of one piece of scope of this work, but e.g. in the snuba params fetch these need to be one unified approach to fetching projects (using just the 'project' param vs multiple different narrowly typed params):

slugs = project_slugs or set(filter(None, request.GET.getlist("projectSlug")))
ids = project_ids or self.get_requested_project_ids_unchecked(request)

This should not be an overly complicated thing to fix, it just needs done by someone who can properly test it and ideally someone who's familiar w/ the current generation of code.

Note this probably goes beyond that one param implementation, that was just what I found in a couple minutes of grepping the codebase.

cmanallen added a commit that referenced this issue Apr 7, 2025
…88906)

We allow the project slug to be specified as well as the project id.
This pull updates the OpenAPI docs to reflect that.

Ref: #88776
andrewshie-sentry pushed a commit that referenced this issue Apr 8, 2025
…88906)

We allow the project slug to be specified as well as the project id.
This pull updates the OpenAPI docs to reflect that.

Ref: #88776
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

No branches or pull requests

1 participant