How do I get all posts from a specific category?

Is there a way to get all the posts from a certain category by a specific user?

Something like this?
https://meta.discourse.org/search?q=category%3Abug%20user%3Acpradio

4 Likes

i didnt see it in any of the posts… is there a specific URL i can query?

Don’t look at the results, look at the URL and how it is querying for a category and a specific user.

thanks got it, is there any way to get the raw data? i saw a search() function in the API, but not sure how to include the parameters.

gives you

https://meta.discourse.org/search.json?q=category%3Abug+user%3Acpradio

2 Likes

awesome thanks… anyone know how to use the Ruby gem to call this?
https://github.com/discourse/discourse_api

I see in the source code, but wasnt able to create the right parameters to successfully retrieve the query results.

  # @param term [String] a search term
  # @param options [Hash] A customizable set of options
  # @option options [String] :type_filter Returns results of the specified type.
  # @return [Array] Return results as an array of Hashes.
  def search(term, options={})
    response = get('/search/query', options.merge(term: term))
    response[:body]
  end

Sorry, I’m not very keen on Ruby, but it should be as simple as sending a HTTP Get request to https://meta.discourse.org/search.json?q=category%3Abug+user%3Acpradio and just replacing the string sent as q=

1 Like

Looks like it would be api_object.get('/search', {q: 'category:bug user:cpradio'})

2 Likes