Cloud Search is a schema-less document oriented search engine for semi-structured documents. When JSON document is added, Cloud Search will automatically index each field and treat types such as numbers and text appropriately.

Documents

Cloud search documents are schema-less JSON documents such as:

[{
          "key": "/cs/demo/documentA",
          "title": "Welcome",
          "body": "Hello world! Welcome to Hub9 CloudSearch",
          "views": 1283,
          "author": "Sabrina"
        },
        
        {
          "key": "/cs/demo/documentB",
          "title": "The title field is a default field for searches",
          "body": "The body field is the other default field for searches",
          "views": 892,
          "author": "Enrico"
        },
        
        {
          "key": "/cs/demo/documentC",
          "body": "This document has no title field",
          "other_field" : "This field is not searched by default",
          "views": 8922,
          "author": "Mike"
        }]

Requests

The Cloud Search API uses a RESTful HTTP protocol. The general URL format for all requests is:

https://USERNAME.api.hub9.com/VERSION/key?oauth_token=TOKEN&[callback=CALLBACK]

Developer Sandbox

The sandbox is used to develop and test CloudSearch client code. The sandbox is available to everyone and no signup is required.

  1. The sandbox is limited to 1000 documents
  2. Documents older than 24 hours are automatically deleted

Your free sandbox token is

c2FuZGJveHwvY3MvfFBHRHxWd3J3WHB0WG5QajQ0ZlByejEtSnlnfEVDOEJBMzNFMg|1P2x8U89LreieoySLsy1qeH2q9I

VERSION

The current version of the API is: v0

KEY

Every Cloud Search document has a unique key. "/cs" is the root level key that contains every document stored in Cloud search.

https://sandbox.api.hub9.com/0/cs
        https://sandbox.api.hub9.com/0/cs/
        https://sandbox.api.hub9.com/0/cs/mydocument
        https://sandbox.api.hub9.com/0/cs/key/to/mydocument

Each document can have an arbitrary levels of folders that contain a document. Folders are automatically created when a document is stored in a folder and automatically removed when they are empty. keys are case sensitive /cs/key/to/mydocument is a different document than /cs/key/to/MyDocument

TOKEN

Every request to the Cloud Search API must include an access token in the oauth_token URL query parameter field. Tokens control how documents in Cloud Search may be accessed. Tokens are managed on the Tokens Dashboard. Each account can have multiple tokens with different permissions for different applications. A token consists of a Root Key and a list of Permissions.

Root key

The root key controls the top level folder and its contents that a client may accesss. For example:

/cs

can access Cloud Search meta data and every document

/cs/

can access every document

/cs/demo/blog/

can only access a document2 and document3

/cs/demo/blog/document3

can only access document 3

Permissions

A token's permissions include at least one of

GET: Get or search documents

PUT: Insert or overwrite documents

DELETE: Delete documents and folders

CALLBACK

All requests accept an optional callback parameter resulting in a JSONP response.

Index Management

Before using an index you need to create an index and assign it a name. This name (NOT its code) has to be provided at creation time, and is used to reference that index in all other API calls.

GET /v0/cs

Returns the number of documents and the size of the data stored in Cloud Search.

Response

200 OK
403 Access denied
404 File not found