class Thoth::TagApiController
Public Instance Methods
suggest()
click to toggle source
Returns a JSON array of existing tag names and usage counts for tags that begin with the specified query string.
Query Parameters¶ ↑
- q
-
query string
- limit
-
(optional) maximum number of tags to return
Sample Response¶ ↑
[["foo",15],["foobar",11],["foosball",2]]
# File lib/thoth/controller/api/tag.rb, line 45 def suggest error_403 unless auth_key_valid? unless request[:q] error_400('Missing required parameter: q') end query = request[:q].lstrip limit = request[:limit] ? request[:limit].to_i : 1000 response['Content-Type'] = 'application/json' JSON.generate(Tag.suggest(query, limit)) end