Skip to content
This repository has been archived by the owner on Mar 30, 2021. It is now read-only.
Noufal Ibrahim edited this page Dec 4, 2013 · 3 revisions

API

This is the first cut of the search API

The endpoint will be /search and it will expect json fragment in the following format POSTed to it as the value of query.

{
  "item"   : "campaign" | "user" | "project" | ....,

  "expand" : "true",

  "params" : {
              "key1" : "val1"
              .
              .
              .
              .
             },


  "text"  : "Some search string"

}

The item should be one of the possible items to search for. I'll put in a proper list here.

expand will return expanded versions of all the matching objects (if you want more than just identifiers and names).

params are keys that should match exactly.

text is full text search inside the larger fields (e.g. description for the campaign). I'll detail exactly which fields later. This can be made fuzzy.

The params are applied first to filter the values. After that, the text is applied to narrow results.

Return value

This will return a json fragment of the following format.

{
 "item"   : "campaign" | "user" | "project" | ....,
 "expand" : "true" | "false"
 "matches" :  [
                { "id" : id,
                  "name" : "Name of the object"
                  "url"  : "http://frp-test.prathambooks.org/api/v1/campaign/id
                  .
                  .
                  .
                },
                .
                .
                .
              ]
 "messages" : [ "Extra messages from server"]
}

This will return back a list of objects all of the type specified in item. Each one will have id, name and url. If the expand parameter was true, in addition to these three, it will give you all the fields of the matching objects. The expand parameter tells you whether an expanded query was possible for the object and whether all fields are being returned. Any other informational messages from the server will be in messages.

Clone this wiki locally