Search Call

/search

Returns the SMA Universe data.

CURL Request Example

curl --compressed --data "api_key=***3c1397f109dd7d62515b49b8b74e9a263c***&function=search" "https://api2.socialmarketanalytics.com/api/search?subject=all&ontology=industry&items=sscore,smean,sbuzz&dates=datetime+ge+201310270000&frequency=1d&sort=sscore+desc,smean+desc,sbuzz+desc"

Response Example

{"response":{"tokendetails":{"api_token":"dac28c9e53d7fa16420830aec88bca00","function":"search","request_quota_remaining":"180","expires":"2013-10-28 03:14:25","ip_address":"50.63.50.192","records_quota_remaining":"100"},"search_params":{"subject":"all","ontology":"industry","items":"sscore,smean,sbuzz","dates":"datetime ge 15m","frequency":"1d","filter":"","sort":"sscore desc,smean desc,sbuzz desc","domain":"finance","format":"json","limit":"10","received":"2013-10-28 03:10:25","completed":"2013-10-28 03:10:25"},"data":[{"datetime":"2013-10-28 05:40:00","subject":"Tobacco Products, Other","sscore":"1.4731","smean":"-0.0095","sbuzz":"2.3810"},{"datetime":"2013-10-28 05:40:00","subject":"Beverages - Brewers","sscore":"0.8580","smean":"0.1805","sbuzz":"1.3400"},{"datetime":"2013-10-28 05:40:00","subject":"Sporting Goods","sscore":"0.8265","smean":"0.4546","sbuzz":"2.0410"},{"datetime":"2013-10-28 05:40:00","subject":"Marketing Services","sscore":"0.7850","smean":"0.2787","sbuzz":"2.0550"},{"datetime":"2013-10-28 05:40:00","subject":"REIT - Office","sscore":"0.7780","smean":"0.2223","sbuzz":"1.5620"},{"datetime":"2013-10-28 05:40:00","subject":"Health Care Plans","sscore":"0.6838","smean":"0.2249","sbuzz":"1.2270"},{"datetime":"2013-10-28 05:40:00","subject":"General Building Materials","sscore":"0.6562","smean":"0.9809","sbuzz":"1.5220"},{"datetime":"2013-10-28 05:40:00","subject":"Security & Protection Services","sscore":"0.5446","smean":"0.2790","sbuzz":"0.0000"},{"datetime":"2013-10-28 05:40:00","subject":"Scientific & Technical Instruments","sscore":"0.5107","smean":"0.8250","sbuzz":"1.8800"},{"datetime":"2013-10-28 05:40:00","subject":"Wireless Communications","sscore":"0.4528","smean":"0.9301","sbuzz":"0.6310"}]}}
{ "response": { "tokendetails": { "api_token": "33a4b798bc6ac9bcd4ab8aedf16687f2", "function": "search", "request_quota_remaining": "180", "expires": "2013-11-01 03:07:37", "ip_address": "50.63.50.192", "records_quota_remaining": "100" }, "search_params": { "subject": "all", "ontology": "ticker", "items": "sscore,smean,sbuzz", "dates": "datetime eq recent", "frequency": "", "filter": "", "sort": "sscore desc,smean desc,sbuzz desc1", "domain": "finance", "format": "json", "limit": "10", "received": "2013-11-01 03:07:43", "completed": "2013-11-01 03:07:43" }, "error": { "error_code": 2115, "error_message": "Invalid sort", "description": "Specified sort is invalid. Default sort pattern is descending in order specified on items list. Items in sort pattern must appear on items list. Sort order must be either asc or desc.", "invalid_params": { "type": "sort", "params": [ [ "sbuzz", "desc1" ] ] } } } }
{ "response": { "tokendetails": { "api_token": "ff0533e171594cc4710bd64d02bcf0bf", "function": "search", "request_quota_remaining": 179, "expires": "2015-08-12 02:46:21", "ip_address": "21.251.31.61", "records_quota_remaining": 999998 }, "search_params": { "subject": "AAPL,BBRY,GOOGG", "ontology": "ticker", "items": "sscore,smean,sdispersion", "dates": "datetime eq recent", "frequency": "", "cycle": "", "filter": "", "sort": "sscore desc,smean desc,sdispersion desc", "domain": "finance", "format": "json", "limit": "10", "timezone": "US\/Eastern", "received": "2015-08-12 03:41:21", "completed": "2015-08-12 03:41:21" }, "data": [ { "datetime": "2015-08-12 03:40:00", "subject": "AAPL", "sscore": "0.6000", "smean": "49.8444", "sdispersion": "0.245" }, { "datetime": "2015-08-12 03:40:00", "subject": "BBRY", "sscore": "0.1946", "smean": "11.1128", "sdispersion": "0.293" } ], "warnings": [ { "warning_id": 4002, "warning_message": "Subject list contains invalid tickers. ", "invalid_tickers": [ "GOOGG" ] } ] } }

Parameters

Parameters Required Description
key string API level Parameter required

Key must be sent using POST method. Key parameter is required to call the API.

function string API level Parameter required

Function must be sent using POST method. Function parameter is required to tell the API which function needs to be called.

subject string required

Subject parameter is directly dependent on ontology parameter.

  • ticker: Vaild SMA universe ticker.
  • index: Valid SMA universe index.
  • universe: SMA User Custom defined ticker universe.
  • sector: Vaild SMA universe sector.
  • industry: Vaild SMA universe industry.

Use all or any for complete SMA universe and custom for ontology universe.

Multipule values are accepted. Only Comma separated values are allowed.

ontology string optional

Possible ontologies are ticker, index, universe, sector,industry,future,forex and etf. Without these ontologies API shall return an error. Ontology parameter is case sensitive. API shall return error for more than 1 ontology in a request.

Default value for ontology is ticker.

items string optional

Possible items are sscore, smean, sbuzz, svolume, sdelta, sdispersion, svolatility, svmean,svscore,s,svvolatility,raws,rawsscore,rawsmean and rawsvolatility. Without these items API shall return an error. Items parameter is case sensitive.

Multipule values are accepted. Only Comma separated values are allowed.

Default values for items are sscore,sbuzz,sdispersion.

dates string optional

Possible value is either a specific datetime or range of datetime. For datetime range, provide Start and End datetime. Possible dates operators are lt, le, gt, ge and eq. Dates parameter is case sensitive.

Plus (+) signs can be used to format the dates parameter for a request.

Start and End datetime values are separated by Comma.

Ex (Specific datetime): dates=datetime+ge+201310290000
Ex (Range): dates=datetime+ge+201310210000,datetime+lt+201310300000

Default value for dates is datetime+eq+recent.

frequency string optional

Possible frequencies are 1d, 1h, 30m, and 15m. Frequency parameter is case sensitive.

Default value for frequency is 1d.

cycle string optional

cycle parameter is directly dependent on frequency parameter. cycle parameter must be less than or equal to frequency parameter.

Possible cycles values is numeric value with m, h or d suffix. cycle parameter is case sensitive.

Ex: cycle=1d

filter string optional

Possible filters are sscore, svolume, smean, svscore, svolatility, svmean, mktcap, lastclose, time, sdelta, sbuzz, sdispersion, s,svvolatility,raws,rawsscore,rawsmean and rawsvolatility. Possible filter operators are lt, le, gt, ge and eq. Filter parameter is case sensitive.

Multipule values are accepted. Only Comma separated values are allowed.

Plus (+) signs can be used to format the filter parameter for a request.

Ex (Single filter value): sscore+lt+3
Ex (Multipule filter values): sscore+lt+3,svolume+gt+3

sort string optional

Sort parameter is directly dependent on items parameter with addition of asc or desc direction. Sort parameter is case sensitive.

Multipule values are accepted. Only Comma separated values are allowed.

Plus (+) signs can be used to format the sort parameter for a request.

Ex (Single sort value): sscore is selected Items parameter, and for sort value score is concatinated with either asc or desc. Possible sort value shall be sscore+desc or sscore+asc.
Ex (Multipule sort values): sscore,smean and sbuzz are selected Items parameter, and for sort value all selected items shall be concatinated with either asc or desc. Possible sort values are sscore+desc,smean+asc,sbuzz+desc.

Default values for sort parameter is based on items parameter. All selected items parameter shall be concatinated with desc.

Default values for items are sscore,sbuzz,sdispersion then possible sort default values shall be sscore+desc,sbuzz+desc,sdispersion+desc.

domain string optional

Possible domain value is finance.

Default value for domain is finance.

format string optional

Possible format value is json.

Default value for format is json.

limit integer optional

The limit parameter constrains the maximum number of records returned by a query.

Possible limit value is any postive integer. Maximum allowed limit is 10000.

Default value for limit is 10.

timezone string optional

The default time zone is ‘US/Eastern’ or ‘America/New_York’. This parameter can be used to choose the time zone of the API query. The returned data datetime will be reported for this time zone as well.

Return Value
JSON Array Response JSON array shall contain error (optional), API token details, search parameters and resultant data.
response Array
tokendetails array Provide the information about API internal handshaking mechanism.
api_token string Token for internal handshaking.
function string API function.
request_quota_remaining integer Number of requests left for the current token.
expires datetime Date & time at which, token shall expire.
ip_address string Ip address used by the current token.
records_quota_remaining integer Number of records left for the current token.
search_params array Provide the function parameters.
subject string API search function parameter.
ontologystring API search function parameter.
itemsstring API search function parameter.
datesstring API search function parameter.
frequencystring API search function parameter.
cyclestring API search function parameter.
filterstring API search function parameter.
sort string API search function parameter.
domainstring API search function parameter.
formatstring API search function parameter.
json string API search function parameter.
limit integer API search function parameter.
timezone string API search function parameter.
received string Date & time when request is received.
completed string Date & time when request is completed.
data array Provide the resultant data.
datetime string Date & time of the record.
subject string Subject provided in function parameter.
items string Items provided in function items parameter.
warnings array Provide the information about warnings.
warning_codestring Warning code number.
warning_message string Warning message.
invalid_tickers array Only available when subject list contains invalid ticker(s).
error array Provide the information about error.
error_codestring Error code number.
error_message string Error message.
description string Detailed error message.
invalid_params array
typestring Search Error parameter.
params array Search Error parameter value.

Errors

Error Code Error Message
1000 Authentication error.
1001 Forbidden.
1002 Your API access is suspended.
1003 Secure connection required. Please use https to connect.
1004 Must use POST to send API key & function.
1005 Your API seat access is suspended.
1011 API key is missing.
1012 Invalid API key.
1013 Expired API token.
1014 Invalid API token.
1015 Invalid API token.
1016 Your ontology access is suspended.
1050 Gone. API endpoint is not available.
1100 Quota exceeded.
1101 Request limit exceeded.
1102 Subject limit exceeded.
1103 Record limit exceeded.
1110 Exceeded number of clients.
2000 Missing required parameter.
2001 API function required.
2011 Ontology is required.
2012 Subject is required.
2013 Items are required.
2100 Syntax error.
2101 Unknown parameter.
2111 Invalid domain.
2112 Invalid ontology.
2113 Invalid subject.
2114 Invalid item.
2115 Invalid sort.
2116 Invalid frequency.
2117 Invalid filter.
2118 Invalid limit.
2119 Invalid format.
2120 Invalid date.
2121 Invalid API function.
2122 Invalid API timezone.
2123 Invalid cycle.
2124 Invalid cycle.
2125 Invalid cycle.
2201 Only one domain may be present in a request.
2202 Only one ontology may be present in a request.
2203 No custom list found.
3000 Internal Error.
3001 Service Unavailable. Api is down or being upgraded.
3002 Server capacity exceeded.
3003 Database server is down. We expect to be back shortly.
3103 Gateway timeout. Please try again.

Warnings

Code Subject
4000 Symbol does not have sufficient twitter activity to derive requested metric.
4001 Your record limit is changed due to short record limit.
4002 Subject list contains invalid ticker(s).