API endpoint to filter assets by internal name #1998
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a new endpoint in the sponsors API to filter assets by their
internal_name. The endpoint URL is/api/v2/sponsors/sponsorship-assets/and it always require ainternal_nameto be passed as a query string parameter. Ifinternal_nameis missing, the response is a bad request.By default, the endpoint only lists assets which have a value (text or image) associated to it, but it's possible to list every asset by passing
list_empty=truewithin the query string.Here's a response payload example I got from my local database:
[{ "internal_name": "pycon_logo", "uuid": "55f69c46-8d94-4196-9157-76ed6219b120", "value": "/media/sponsors-app-assets/55f69c46-8d94-4196-9157-76ed6219b120.jpeg", "content_type": "Sponsor", "sponsor": "Globe" }, { "internal_name": "pycon_logo", "uuid": "2f05d02c-e78a-4976-8b77-5a665612c776", "value": "/media/sponsors-app-assets/2f05d02c-e78a-4976-8b77-5a665612c776.jpeg", "content_type": "Sponsor", "sponsor": "BerinTech" }]