Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added documentation for query resource

...

Table of Contents
outlinetrue
excludeMethods

Query items

GET/POST https://topic-api.squirro.com/v0/(string: tenant)/projects/(id: project_id)/items/query

Returns a selection of items from the project. The items be filtered with a query and other parameters.

Parameters:
  • tenant – User tenant.
  • project_id – Project identifier.
JSON Data:

Data is passed in as a JSON object.

Valid object keys:

      • start – the index of the first item to be returned, useful for pagination (default: 0). Since the returned items are filtered after pagination, the start returned in the next_params field should be passed in to avoid receiving duplicate items.
      • count – the number of items returned. Set to 0 to return all items (default 15). Since the returned items are filtered after pagination, the number of returned items may be lower than this number.
      • created_beforeDate and Time value which limits the returned items to items that have been created before this date.
      • created_afterDate and Time value which limits the returned items to items that have been created after this date.
      • options – Dictionary of options that influence the result-set. Currently there is only one option fold_near_duplicates to fold near-duplicates together and filter them out of the result-stream.
      • query – Search for items that match this query. For each item a score is calculated which reflects how well it matches this query.
      • highlight – Dictionary containing highlight information. Keys are:
        • query– Boolean, if True the response will contain highlight information. 
        • smartfiltersList of SmartFilter names to be highlighted.
      • fields – Comma-separated list of fields to return. If this is specified, the return value is limited to only these fields. See the Item Format reference for a list of available fields.
      • aggregations – Dictionary of aggregations to execute on matching items. See Aggregation reference.
      • next_params – For pagination, this should be the unmodified dictionary returned by the previous request

Example request body:

Code Block
languagejs
{
	"query": "Hitachi",
    "start": 0,
    "highlight": {
        "query": true
    }
} 
Headers:See Common Headers.
Status Codes:
  • 200 – Results returned.

See also Common Status Codes.

Returns:

Results including some pagination information.

Response fields:

  • items – List of items.
  • count– The number of items returned with this result set.
  • total – How many items match the current query.
  • eof – True if the there are no further results available to paginate to.
  • next_params – Query parameters that should be passed in with the next request when paginating.
  • aggregations – Result of item aggregation. See Aggregations reference.

 

Code Block
js
js
{
    "count": 1,
    "now": "2014-12-17T14:27:47",
    "next_params": {
        "start": 1,
        "expected_num_results": 92
    },
    "eof": false,
    "items": [
        {
            "body": "<html><body>
<p class=\"tweet\">ABB and <squirro:highlight>Hitachi</squirro:highlight> forms a JV to provide HVDC system…",
            "language": "en",
            "title": "Supreme & Co.",
            "read": false,
            "created_at": "2014-12-17T13:10:45",
            "modified_at": "2014-12-17T13:11:16",
            "related_items": [],
            "id": "Fd2yF5BvQX2LlCdYPZ-Zow",
            "sources": [
                {
                    "link": "https://twitter.com/search?q=abb -is:retweet&f=realtime",
                    "title": "Twitter search for: \"abb\"",
                    "object_ids": [
                        "w--MRsdxR26LlymevPTpMA"
                    ],
                    "id": "nN3pr5BwQJevxbSzMB9Www",
                    "provider": "twitter"
                }
            ],
            "score": null,
            "link": "https://www.facebook.com/pages/Supreme-Co/356890661079035?ref=hl",
            "objects": [
                {
                    "source_ids": [
                        "nN3pr5BwQJevxbSzMB9Www"
                    ],
                    "project_id": "D9omq-WVQ0O2hxYp9fKUlA",
                    "type": "default",
                    "id": "w--MRsdxR26LlymevPTpMA",
                    "title": "default"
                }
            ],
            "keywords": {
                "from": [
                    "supremeco"
                ],
                "Sentiment": [
                    "Neutral"
                ],
                "Geo_State": [
                    "Japan"
                ],
                "verb": [
                    "post"
                ],
                "Organization": [
                    "ABB Group",
                    "Hitachi"
                ]
            },
            "starred": false,
            "external_id": "545204453427531777",
            "abstract": [
                "ABB and <squirro:highlight>Hitachi</squirro:highlight> forms a JV to provide HVDC system solutions in Japan.\ntinyurl.com/nzhqzrfABB",
                " and <squirro:highlight>Hitachi</squirro:highlight> forms a JV to provide HVDC system solutions in Japan.\nBusiness Standard reported that ABB",
                " and <squirro:highlight>Hitachi</squirro:highlight> entered into a JV for providing high voltage direct current system solutions in Japan",
                "-sales services related to the DC system of HVDC projects. <squirro:highlight>Hitachi</squirro:highlight> and ABB will take equity..."
            ]
        }
    ],
    "aggregations": {},
    "total": 92,
    "fingerprint_matches": {}
} 

 

List Items (deprecated)

GET https://topic-api.squirro.com/v0/(string: tenant)/projects/(id: project_id)/items

...