Class: Thoth::TagApiController

### Home Classes Methods

### In Files

- lib/thoth/controller/api/tag.rb

### Parent

Ramaze::Controller

### Methods

- #suggest

### Files

- robots.txt

### Class/Module Index

Quicksearch

- Thoth
- Thoth::AdminController
- Thoth::ArchiveController
- Thoth::Comment
- Thoth::CommentApiController
- Thoth::CommentController
- Thoth::Config
- Thoth::Error
- Thoth::Importer
- Thoth::MainController
- Thoth::Media
- Thoth::MediaController
- Thoth::MinifyController
- Thoth::Page
- Thoth::PageApiController
- Thoth::PageController
- Thoth::Pager
- Thoth::Plugin
- Thoth::Plugin::Delicious
- Thoth::Plugin::Flickr
- Thoth::Plugin::Tags
- Thoth::Plugin::Twitter
- Thoth::Post
- Thoth::PostApiController
- Thoth::PostController
- Thoth::SchemaError
- Thoth::SearchController
- Thoth::Tag
- Thoth::TagApiController
- Thoth::TagController
- Thoth::TagsPostsMap
- Ramaze
- Ramaze::Dispatcher
- Ramaze::Dispatcher::File
- Ramaze::Helper
- Ramaze::Helper::Admin
- Ramaze::Helper::Cookie
- Ramaze::Helper::Error
- Ramaze::Helper::Pagination
- Ramaze::Helper::Sanitize
- Ramaze::Helper::Wiki
- Ramaze::Helper::Ysearch
- Ramaze::Helper::Ysearch::SearchError
- AddMediaSize
- CreateSchema
- PantsImporter
- PoseidonImporter

No matching classes.

# 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 50
    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

[Validate]

Generated with the Darkfish Rdoc Generator 2.