{"action":"created","comment":{"url":"https://api.github.com/repos/salemove/apiary_docs/pulls/comments/42519157","id":42519157,"diff_hunk":"@@ -462,6 +462,98 @@ You can save custom information about the visitor as specified in the 'Update cu\n ?custom_attributes[attribute1]=attribute1+value&custom_attributes[attribute2]=attribute2+value\n ```\n \n+## Statistics\n+Queries are made in JSON using an HTTP REST style request. The query language is based on [Druid query language](http://druid.io/docs/latest/querying/querying.html).\n+\n+### Query Types\n+There are two types of queries: **timeseries** and **group by** queries.\n+\n+#### Query Type: Timeseries\n+These types of queries take a `timeseries` query object and return an array of JSON objects where each object represents a value asked for by the timeseries query.\n+\n+An example timeseries query object against `/engagements/stats/count` endpoint is shown below\n+```js\n+    {\n+      \"query_type\": \"timeseries\",\n+      \"granularity\": \"all\",\n+      \"start_date\": \"2015-01-01T00:00:00Z\",\n+      \"end_date\": \"2016-01-01T00:00:00Z\",\n+      \"filter\": {\"type\": \"selector\", \"dimension\": \"type\", \"value\": \"reactive\"}\n+    }\n+```\n+\n+There are 5 main parts to a timeseries query:","path":"apiary.apib","position":24,"original_position":24,"commit_id":"652640e941623e96f36019d8a96b033aef626b2f","original_commit_id":"652640e941623e96f36019d8a96b033aef626b2f","user":{"login":"deiwin","id":2261897,"avatar_url":"https://avatars.githubusercontent.com/u/2261897?v=3","gravatar_id":"","url":"https://api.github.com/users/deiwin","html_url":"https://github.com/deiwin","followers_url":"https://api.github.com/users/deiwin/followers","following_url":"https://api.github.com/users/deiwin/following{/other_user}","gists_url":"https://api.github.com/users/deiwin/gists{/gist_id}","starred_url":"https://api.github.com/users/deiwin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deiwin/subscriptions","organizations_url":"https://api.github.com/users/deiwin/orgs","repos_url":"https://api.github.com/users/deiwin/repos","events_url":"https://api.github.com/users/deiwin/events{/privacy}","received_events_url":"https://api.github.com/users/deiwin/received_events","type":"User","site_admin":false},"body":"Also, using the number 5 here (and 6 below) is dangerous, as it can easily get out of date. I would simply write that *A `timeseries` query includes the following parts/fields/arguments/parameters:*","created_at":"2015-10-20T16:30:30Z","updated_at":"2015-10-20T16:30:30Z","html_url":"https://github.com/salemove/apiary_docs/pull/3#discussion_r42519157","pull_request_url":"https://api.github.com/repos/salemove/apiary_docs/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/salemove/apiary_docs/pulls/comments/42519157"},"html":{"href":"https://github.com/salemove/apiary_docs/pull/3#discussion_r42519157"},"pull_request":{"href":"https://api.github.com/repos/salemove/apiary_docs/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/salemove/apiary_docs/pulls/3","id":48091943,"html_url":"https://github.com/salemove/apiary_docs/pull/3","diff_url":"https://github.com/salemove/apiary_docs/pull/3.diff","patch_url":"https://github.com/salemove/apiary_docs/pull/3.patch","issue_url":"https://api.github.com/repos/salemove/apiary_docs/issues/3","number":3,"state":"open","locked":false,"title":"Add engagement count statistics endpoint","user":{"login":"indrekj","id":3438,"avatar_url":"https://avatars.githubusercontent.com/u/3438?v=3","gravatar_id":"","url":"https://api.github.com/users/indrekj","html_url":"https://github.com/indrekj","followers_url":"https://api.github.com/users/indrekj/followers","following_url":"https://api.github.com/users/indrekj/following{/other_user}","gists_url":"https://api.github.com/users/indrekj/gists{/gist_id}","starred_url":"https://api.github.com/users/indrekj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indrekj/subscriptions","organizations_url":"https://api.github.com/users/indrekj/orgs","repos_url":"https://api.github.com/users/indrekj/repos","events_url":"https://api.github.com/users/indrekj/events{/privacy}","received_events_url":"https://api.github.com/users/indrekj/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-19T16:05:56Z","updated_at":"2015-10-20T16:30:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e87524401eeca2565828192cdf6c3cb330b9ddf9","assignee":{"login":"deiwin","id":2261897,"avatar_url":"https://avatars.githubusercontent.com/u/2261897?v=3","gravatar_id":"","url":"https://api.github.com/users/deiwin","html_url":"https://github.com/deiwin","followers_url":"https://api.github.com/users/deiwin/followers","following_url":"https://api.github.com/users/deiwin/following{/other_user}","gists_url":"https://api.github.com/users/deiwin/gists{/gist_id}","starred_url":"https://api.github.com/users/deiwin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deiwin/subscriptions","organizations_url":"https://api.github.com/users/deiwin/orgs","repos_url":"https://api.github.com/users/deiwin/repos","events_url":"https://api.github.com/users/deiwin/events{/privacy}","received_events_url":"https://api.github.com/users/deiwin/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/salemove/apiary_docs/pulls/3/commits","review_comments_url":"https://api.github.com/repos/salemove/apiary_docs/pulls/3/comments","review_comment_url":"https://api.github.com/repos/salemove/apiary_docs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/salemove/apiary_docs/issues/3/comments","statuses_url":"https://api.github.com/repos/salemove/apiary_docs/statuses/652640e941623e96f36019d8a96b033aef626b2f","head":{"label":"salemove:statistics","ref":"statistics","sha":"652640e941623e96f36019d8a96b033aef626b2f","user":{"login":"salemove","id":5281619,"avatar_url":"https://avatars.githubusercontent.com/u/5281619?v=3","gravatar_id":"","url":"https://api.github.com/users/salemove","html_url":"https://github.com/salemove","followers_url":"https://api.github.com/users/salemove/followers","following_url":"https://api.github.com/users/salemove/following{/other_user}","gists_url":"https://api.github.com/users/salemove/gists{/gist_id}","starred_url":"https://api.github.com/users/salemove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/salemove/subscriptions","organizations_url":"https://api.github.com/users/salemove/orgs","repos_url":"https://api.github.com/users/salemove/repos","events_url":"https://api.github.com/users/salemove/events{/privacy}","received_events_url":"https://api.github.com/users/salemove/received_events","type":"Organization","site_admin":false},"repo":{"id":43673810,"name":"apiary_docs","full_name":"salemove/apiary_docs","owner":{"login":"salemove","id":5281619,"avatar_url":"https://avatars.githubusercontent.com/u/5281619?v=3","gravatar_id":"","url":"https://api.github.com/users/salemove","html_url":"https://github.com/salemove","followers_url":"https://api.github.com/users/salemove/followers","following_url":"https://api.github.com/users/salemove/following{/other_user}","gists_url":"https://api.github.com/users/salemove/gists{/gist_id}","starred_url":"https://api.github.com/users/salemove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/salemove/subscriptions","organizations_url":"https://api.github.com/users/salemove/orgs","repos_url":"https://api.github.com/users/salemove/repos","events_url":"https://api.github.com/users/salemove/events{/privacy}","received_events_url":"https://api.github.com/users/salemove/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/salemove/apiary_docs","description":"","fork":false,"url":"https://api.github.com/repos/salemove/apiary_docs","forks_url":"https://api.github.com/repos/salemove/apiary_docs/forks","keys_url":"https://api.github.com/repos/salemove/apiary_docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/salemove/apiary_docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/salemove/apiary_docs/teams","hooks_url":"https://api.github.com/repos/salemove/apiary_docs/hooks","issue_events_url":"https://api.github.com/repos/salemove/apiary_docs/issues/events{/number}","events_url":"https://api.github.com/repos/salemove/apiary_docs/events","assignees_url":"https://api.github.com/repos/salemove/apiary_docs/assignees{/user}","branches_url":"https://api.github.com/repos/salemove/apiary_docs/branches{/branch}","tags_url":"https://api.github.com/repos/salemove/apiary_docs/tags","blobs_url":"https://api.github.com/repos/salemove/apiary_docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/salemove/apiary_docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/salemove/apiary_docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/salemove/apiary_docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/salemove/apiary_docs/statuses/{sha}","languages_url":"https://api.github.com/repos/salemove/apiary_docs/languages","stargazers_url":"https://api.github.com/repos/salemove/apiary_docs/stargazers","contributors_url":"https://api.github.com/repos/salemove/apiary_docs/contributors","subscribers_url":"https://api.github.com/repos/salemove/apiary_docs/subscribers","subscription_url":"https://api.github.com/repos/salemove/apiary_docs/subscription","commits_url":"https://api.github.com/repos/salemove/apiary_docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/salemove/apiary_docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/salemove/apiary_docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/salemove/apiary_docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/salemove/apiary_docs/contents/{+path}","compare_url":"https://api.github.com/repos/salemove/apiary_docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/salemove/apiary_docs/merges","archive_url":"https://api.github.com/repos/salemove/apiary_docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/salemove/apiary_docs/downloads","issues_url":"https://api.github.com/repos/salemove/apiary_docs/issues{/number}","pulls_url":"https://api.github.com/repos/salemove/apiary_docs/pulls{/number}","milestones_url":"https://api.github.com/repos/salemove/apiary_docs/milestones{/number}","notifications_url":"https://api.github.com/repos/salemove/apiary_docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/salemove/apiary_docs/labels{/name}","releases_url":"https://api.github.com/repos/salemove/apiary_docs/releases{/id}","created_at":"2015-10-05T08:49:04Z","updated_at":"2015-10-05T08:54:16Z","pushed_at":"2015-10-20T09:23:22Z","git_url":"git://github.com/salemove/apiary_docs.git","ssh_url":"git@github.com:salemove/apiary_docs.git","clone_url":"https://github.com/salemove/apiary_docs.git","svn_url":"https://github.com/salemove/apiary_docs","homepage":null,"size":188,"stargazers_count":0,"watchers_count":0,"language":"API Blueprint","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"salemove:master","ref":"master","sha":"61b93a6c05e53ad346b604ab110f6415d39bb310","user":{"login":"salemove","id":5281619,"avatar_url":"https://avatars.githubusercontent.com/u/5281619?v=3","gravatar_id":"","url":"https://api.github.com/users/salemove","html_url":"https://github.com/salemove","followers_url":"https://api.github.com/users/salemove/followers","following_url":"https://api.github.com/users/salemove/following{/other_user}","gists_url":"https://api.github.com/users/salemove/gists{/gist_id}","starred_url":"https://api.github.com/users/salemove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/salemove/subscriptions","organizations_url":"https://api.github.com/users/salemove/orgs","repos_url":"https://api.github.com/users/salemove/repos","events_url":"https://api.github.com/users/salemove/events{/privacy}","received_events_url":"https://api.github.com/users/salemove/received_events","type":"Organization","site_admin":false},"repo":{"id":43673810,"name":"apiary_docs","full_name":"salemove/apiary_docs","owner":{"login":"salemove","id":5281619,"avatar_url":"https://avatars.githubusercontent.com/u/5281619?v=3","gravatar_id":"","url":"https://api.github.com/users/salemove","html_url":"https://github.com/salemove","followers_url":"https://api.github.com/users/salemove/followers","following_url":"https://api.github.com/users/salemove/following{/other_user}","gists_url":"https://api.github.com/users/salemove/gists{/gist_id}","starred_url":"https://api.github.com/users/salemove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/salemove/subscriptions","organizations_url":"https://api.github.com/users/salemove/orgs","repos_url":"https://api.github.com/users/salemove/repos","events_url":"https://api.github.com/users/salemove/events{/privacy}","received_events_url":"https://api.github.com/users/salemove/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/salemove/apiary_docs","description":"","fork":false,"url":"https://api.github.com/repos/salemove/apiary_docs","forks_url":"https://api.github.com/repos/salemove/apiary_docs/forks","keys_url":"https://api.github.com/repos/salemove/apiary_docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/salemove/apiary_docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/salemove/apiary_docs/teams","hooks_url":"https://api.github.com/repos/salemove/apiary_docs/hooks","issue_events_url":"https://api.github.com/repos/salemove/apiary_docs/issues/events{/number}","events_url":"https://api.github.com/repos/salemove/apiary_docs/events","assignees_url":"https://api.github.com/repos/salemove/apiary_docs/assignees{/user}","branches_url":"https://api.github.com/repos/salemove/apiary_docs/branches{/branch}","tags_url":"https://api.github.com/repos/salemove/apiary_docs/tags","blobs_url":"https://api.github.com/repos/salemove/apiary_docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/salemove/apiary_docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/salemove/apiary_docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/salemove/apiary_docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/salemove/apiary_docs/statuses/{sha}","languages_url":"https://api.github.com/repos/salemove/apiary_docs/languages","stargazers_url":"https://api.github.com/repos/salemove/apiary_docs/stargazers","contributors_url":"https://api.github.com/repos/salemove/apiary_docs/contributors","subscribers_url":"https://api.github.com/repos/salemove/apiary_docs/subscribers","subscription_url":"https://api.github.com/repos/salemove/apiary_docs/subscription","commits_url":"https://api.github.com/repos/salemove/apiary_docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/salemove/apiary_docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/salemove/apiary_docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/salemove/apiary_docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/salemove/apiary_docs/contents/{+path}","compare_url":"https://api.github.com/repos/salemove/apiary_docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/salemove/apiary_docs/merges","archive_url":"https://api.github.com/repos/salemove/apiary_docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/salemove/apiary_docs/downloads","issues_url":"https://api.github.com/repos/salemove/apiary_docs/issues{/number}","pulls_url":"https://api.github.com/repos/salemove/apiary_docs/pulls{/number}","milestones_url":"https://api.github.com/repos/salemove/apiary_docs/milestones{/number}","notifications_url":"https://api.github.com/repos/salemove/apiary_docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/salemove/apiary_docs/labels{/name}","releases_url":"https://api.github.com/repos/salemove/apiary_docs/releases{/id}","created_at":"2015-10-05T08:49:04Z","updated_at":"2015-10-05T08:54:16Z","pushed_at":"2015-10-20T09:23:22Z","git_url":"git://github.com/salemove/apiary_docs.git","ssh_url":"git@github.com:salemove/apiary_docs.git","clone_url":"https://github.com/salemove/apiary_docs.git","svn_url":"https://github.com/salemove/apiary_docs","homepage":null,"size":188,"stargazers_count":0,"watchers_count":0,"language":"API Blueprint","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/salemove/apiary_docs/pulls/3"},"html":{"href":"https://github.com/salemove/apiary_docs/pull/3"},"issue":{"href":"https://api.github.com/repos/salemove/apiary_docs/issues/3"},"comments":{"href":"https://api.github.com/repos/salemove/apiary_docs/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/salemove/apiary_docs/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/salemove/apiary_docs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/salemove/apiary_docs/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/salemove/apiary_docs/statuses/652640e941623e96f36019d8a96b033aef626b2f"}}}}