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

Add metadata parameter to /dandisets/{dandiset_id}/ endpoint #2153

Open
jwodder opened this issue Jan 23, 2025 · 3 comments
Open

Add metadata parameter to /dandisets/{dandiset_id}/ endpoint #2153

jwodder opened this issue Jan 23, 2025 · 3 comments
Labels
enhancement New feature or request

Comments

@jwodder
Copy link
Member

jwodder commented Jan 23, 2025

Making a request to /dandisets/$ID/?metadata=1 should return a response that includes "metadata" fields in the version objects containing the draft and lastest versions' metadata. This would cut down on some of the requests that dandidav has to make.

@yarikoptic
Copy link
Member

We already have similar metadata flag for /dandisets/{versions__dandiset__pk}/versions/{versions__version}/assets/
https://github.com/dandi/dandi-archive/blob/HEAD/dandiapi/api/views/serializers.py#L373

❯ git grep -p 'metadata = serializers.Bool'
dandiapi/api/views/serializers.py=class AssetListSerializer(serializers.Serializer):
dandiapi/api/views/serializers.py:    metadata = serializers.BooleanField(required=False, default=False)

I think that pretty much every List serializer should gain such an option -- it would make use of the API more efficient, avoiding subsequent individual queries etc, and otherwise would come "for free" for us AFAIK.

@danlamanna
Copy link
Contributor

Are there expected to be other fields in the future that could optionally be included? One pattern I've seen in other REST APIs is to have an include or expand parameter with a comma-delimited list of fields.

@jwodder
Copy link
Member Author

jwodder commented Feb 3, 2025

@danlamanna I don't think version objects have any other fields to include.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants