Skip to content

Instantly share code, notes, and snippets.

@muatik
Last active December 14, 2015 04:29
Show Gist options
  • Save muatik/5028671 to your computer and use it in GitHub Desktop.
Save muatik/5028671 to your computer and use it in GitHub Desktop.
The API calls of Trend Analyzer. This file is used in the api console.
var APICALLS=[
{
"title": "Start an analysis",
"description": "<p>With this request, you can start an analysis. An analysis may take a long time,</p><p>depending upon content on which the analysis will be performed.</p><p><strong>Resource Path:</strong> /analysis</p><p><strong>HTTP Request Type:</strong> PUT</p><h3>Resource Parameters</h3><p>These parameters must be provided in resource as shown below:</p><p><b>Example:</b> /analysis/daily/2013-02-16 15:30</p><p><b>Example:</b> /analysis/hourly/2013-02-21 06:30</p><table class='params'><thead><tr><th>Parameter</th><th>Required</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>interval</td><td>YES</td><td>The interval of analysis. This can be one of the followings: hourly, daily, weekly, monthly</td><td>daily</td></tr><tr><td>date</td><td>YES</td><td>The date od analysis. YYY-MM-HH:MM</td><td>2013-01-15 19:00</td></tr></tbody></table><h3>Restriction Paramters</h3><p>These parameters must be provided as HTTP post fields as shown below:</p><pre class=\"code\">Put /analysis/hourly/2013-02-16%2015%3a30 HTTP/1.1\nHost: trend.botego.net\nAccept-Encoding: gzip, deflate\n\nlanguage=tr&gender=female</pre><table class='params'><thead> <tr><th>Parameter</th><th>Required</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>ma</td><td>YES</td><td>This parameter will provide required terms(pepsi, an hotel name etc.) for an analysis. (<i>not certainly decided what this parameter will be. ask ubitech</i>) monitoring activity</td><td>ma_url</td></tr><tr><td>language</td><td>NO</td><td>Restricts result by the given language, specified as an ISO 639-1 code.<a href=\"http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes\">http://en.wikipedia.org/wiki/List_of_ISO_639_codes</a></td><td>en</td></tr><tr><td>country</td><td>NO</td><td>Restricts result to the given country, specified as <a href=\"http://en.wikipedia.org/wiki/ISO_3166-1\">ISO 3166-1</a> code</td><td>tr</td></tr><tr><td>age</td><td>NO</td><td>Restricts result to the given age, specified as a range [min, max]</td><td>18,22</td></tr><tr><td>gender</td><td>NO</td><td>Restricts result to the given gender, specified as “male” or “female”</td><td>male</td></tr></tbody></table>",
"examples": [
{
"title": "An example of general analysis",
"path": "/v1/API/analysis/hourly/2013-02-21 15:00",
"method": "PUT",
"headers": [
{
"name": "host",
"value": "trend.botego.net"
}
],
"postField": []
},
{
"title": "An example of restricted analysis to the given language and gender",
"path": "/v1/API/analysis/hourly/2013-02-21 15:00",
"requestMethod": "PUT",
"headers": [
{
"name": "host",
"value": "trend.botego.net"
}
],
"postFields": [
{
"name": "language",
"value": "tr"
},
{
"name": "gender",
"value": "female"
}
]
}
]
},
{
"title": "Get the list of cached analyses",
"description": "<p>This API call gives the list of already completed and cached analyses.</p><p>Yo do not need to provide any resource or restriction parameters for this call.</p><p><strong>Resource path:</strong> /analysis/cached</p><p><strong>HTTP Request Type:</strong> GET</p>",
"examples": [
{
"title": "An example of getting the cached analyses",
"path": "/v1/API/analysis/cached",
"method": "GET",
"headers": [
{
"name": "host",
"value": "trend.botego.net"
}
],
"postField": []
}
]
},
{
"title": "Get the result of a cached analysis",
"description": "<p>This API call gives the result of an analysis which has been already performed. When an analysis is completed, the result of the analysis will be saved in local store for caching. So, the response of this call will be a cached result.</p><p>You only have to provide the id of analysis.</p><p><strong>Resource Path:</strong> /analysis/$ANALYSIS_ID </p><p><strong>HTTP Request Type:</strong> GET</p><h3>Resource Parameters</h3><p>These parameters must be provided in resource as shown below:</p><p><i>Example:</i> /analysis/51223196d09acb4919000000</p><table class='params'><thead><tr><th>Parameter</th><th>Required</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>analysis_id</td><td>YES</td><td>The id of analysis</td><td><i>51223196d09acb4919000000</i></td></tr></tbody></table>",
"examples": [
{
"title": "Example",
"path": "/v1/API/analysis/5127381f8e27e7bf40000000",
"method": "PUT",
"headers": [
{
"name": "host",
"value": "trend.botego.net"
}
],
"postField": []
}
]
},
{
"title": "Get the detail of specified event",
"description": "<p>This API call gives the detailed information(country, age, gender etc.) for a trending event.</p><p>You only have to provide the id of analysis in which the event is, and the id of the event.</p><p><strong>Resource path:</strong> /analysis/$ANALYSIS_ID/events/$EVENT_ID</p><p><strong>HTTP Request Type:</strong> GET </p><h3>Resource Parameters</h3><p>These parameters must be provided in resource as shown below:</p><p><i>Example:</i> /analysis/51223196d09acb4919000000/events/0</p><table class='params'><thead><tr><th>Parameter</th><th>Required</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>analysis_id</td><td>Yes</td><td>The id of analysis</td><td><i>51223196d09acb4919000000</i></td></tr><tr><td>event_id</td><td>Yes</td><td>The id of event</td><td>0</td></tr></tbody></table>",
"examples": [
{
"title": "Example",
"path": "/v1/API/analysis/5127381f8e27e7bf40000000/events/0",
"method": "PUT",
"headers": [
{
"name": "host",
"value": "trend.botego.net"
}
],
"postField": []
}
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment