Difference between revisions of "stoney core: Search Resource - REST API"

From stoney cloud
Jump to: navigation, search
[unchecked revision][unchecked revision]
(stoney core: search resource methods)
(Resellers Search (GET))
Line 24: Line 24:
 
The following special resources don't have additional search methods:
 
The following special resources don't have additional search methods:
 
* [[stoney core: Authentication Resource - REST API]]
 
* [[stoney core: Authentication Resource - REST API]]
 +
 +
== Global Search (GET) ==
 +
To form a fulltext search, append the url query parameter '''q''' with the desired search text: <code>https://api.example.com/v1/resellers?q=example</code>.
 +
 +
=== Global Search Request Message ===
 +
{| class="wikitable sortable" style="width: 100%;"
 +
|-
 +
! HTTP request part
 +
! Content
 +
! Example
 +
 +
|-
 +
| Request lines
 +
|<pre>
 +
GET <Request-URI> HTTP 1.1
 +
HOST: <Host>
 +
</pre>
 +
|<pre>
 +
GET /v1/resellers/ HTTP 1.1
 +
HOST: api.example.com
 +
</pre>
 +
 +
|-
 +
| Request headers
 +
| <pre>
 +
Accept: <Type>/<Subtype>
 +
Accept-Charset: <Charset>
 +
</pre>
 +
| <pre>
 +
Accept: application/json
 +
Accept-Charset: UTF-8
 +
</pre>
 +
 +
|-
 +
| Request body
 +
| <Empty>
 +
| <pre></pre>
 +
 +
|}
 +
 +
=== Global Search Request Response Message ===
 +
{| class="wikitable sortable" style="width: 100%;"
 +
|-
 +
! HTTP response part
 +
! Content
 +
! Example
 +
 +
|-
 +
| Status Line
 +
| <pre>HTTP/1.1 <HTTP-Status-Code> <HTTP-Status-Message></pre>
 +
| <pre>HTTP/1.1 200 OK</pre>
 +
 +
|-
 +
| Response headers
 +
|<pre>
 +
Content-Type: <Type>/<Subtype>; charset=<Charset>
 +
Location: <Location-URI>
 +
Link:
 +
X-Total-Count:
 +
</pre>
 +
|<pre>
 +
Content-Type: Content-Type: application/json; charset=UTF-8
 +
</pre>
 +
 +
|-
 +
| [[#reseller_collection_retrieval_response_object|Response body]]
 +
| JSON object
 +
| <source lang="javascript">{ ... }</source>
 +
 +
|}
  
 
== Resellers Search (GET) ==
 
== Resellers Search (GET) ==

Revision as of 15:42, 14 May 2014

Also visit stoney core: Search Resource Mapping (REST - LDAP) and stoney core: Global Searches.

Overview

The search resource provides a full text search over all the available resources. The available resources are:

A search could look as follows:

The following rules apply:

  • The minimum number of characters for the query are 3.
  • Number of entries returned per object type:
    • Default: 5
    • Maximum: 15 (can be raised by entries get parameter)
  • The attributes returned for each individual resource are presently the same as when querying the corresponding resource collection.

stoney core: search resource methods

As described above, each resource has its own search methods. The current stoney core resources are:

The following special resources don't have additional search methods:

Global Search (GET)

To form a fulltext search, append the url query parameter q with the desired search text: https://api.example.com/v1/resellers?q=example.

Global Search Request Message

HTTP request part Content Example
Request lines
GET <Request-URI> HTTP 1.1
HOST: <Host>
GET /v1/resellers/ HTTP 1.1
HOST: api.example.com 
Request headers
Accept: <Type>/<Subtype>
Accept-Charset: <Charset>
Accept: application/json
Accept-Charset: UTF-8
Request body <Empty>

Global Search Request Response Message

HTTP response part Content Example
Status Line
HTTP/1.1 <HTTP-Status-Code> <HTTP-Status-Message>
HTTP/1.1 200 OK
Response headers
Content-Type: <Type>/<Subtype>; charset=<Charset>
Location: <Location-URI>
Link:
X-Total-Count:
Content-Type: Content-Type: application/json; charset=UTF-8
Response body JSON object
{ ... }

Resellers Search (GET)

Customers Search (GET)

People Search (GET)

{
  "resellers":
  {
    "resources":
    [
      { "id": 4000000,
        "location": "https://api.example.com/v1/resellers/4000000",
        "isCompany": true,
        "isActive": true,
        "resellerName": "Example Reseller Ltd"
      },
      { "id": 4000001,
        "location": "https://api.example.com/v1/resellers/4000001",
        "isCompany": true,
        "isActive": true,
        "resellerName": "Example Reseller No 2 Ltd"
      }
    ],
    "location": "https://api.example.com/v1/resellers/?q=example"
  },
  "customers":
  {
    "resources":
    [
      { "id": 5000000,
        "location": "https://api.example.com/v1/customers/5000000",
        "isCompany": true,
        "isActive": true,
        "customerName": "Example Customer Ltd"        
       },
      { "id": 5000001, ... }
    ],
    "location": "https://api.example.com/v1/customers/?q=example"
  },
  ...
}