Filter topics in category containing file attachments

Is this possible with the API? The purpose is to get a list of topics in a category that contain a PDF, or other media file attached.

1 Like

You can use the advanced search:

https://meta.discourse.org/search?q=filetype:pdf%20%23support
(searches for filetype:pdf #support)

Routes on Discourse have a JSON serializer, so you can tweak the search and then use /search.json?q=your-query.

5 Likes

Another option would be to write a Data Explorer query that returns the topics you are looking for. You could then run that query via the API: How to run Data Explorer queries with the Discourse API.

3 Likes

It looks like search with the parameter would be the easiest option.

Are there and / or operators for search queries? I found the option for categories, but I would like to combine search terms or filetypes - for example

https://meta.discourse.org/search?q=YouTube,soundcloud%20%23support%20

I get 5 results for the combined terms - but it is not showing results for individual terms. Searching just for “soundcloud” on the other hand yields 15 results. I would like to get both with one query… Would this be possible without doing an individual query for each?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.