Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 56 lines (36 sloc) 2.13 kb
28e25fd Matthieu Napoli Refactored into Integrate, Develop, Design + refactored the engine
mnapoli authored
1 ---
2 category: Integrate
f4fece9 Matthieu Napoli #22 Reviewed "Querying the reporting API"
mnapoli authored
3 previous: reporting-api-tutorial
f593920 Matthieu Napoli New guide listing the reporting API clients
mnapoli authored
4 next: reporting-api-clients
28e25fd Matthieu Napoli Refactored into Integrate, Develop, Design + refactored the engine
mnapoli authored
5 ---
cf168c1 Benaka Migrating Reporting API docs from piwik.org to developer.piwik.org. Adde...
diosmosis authored
6 # Querying the Reporting API
7
72a4580 Matthieu Aubry Splitting tutorial back into its own page
mattab authored
8 This guide explains how to call the Piwik API to request your web analytics data. There are two methods:
cf168c1 Benaka Migrating Reporting API docs from piwik.org to developer.piwik.org. Adde...
diosmosis authored
9
f4fece9 Matthieu Napoli #22 Reviewed "Querying the reporting API"
mnapoli authored
10 - using the standard HTTP API
11 - using Piwik's PHP code directly
cf168c1 Benaka Migrating Reporting API docs from piwik.org to developer.piwik.org. Adde...
diosmosis authored
12
080a797 Benaka Revising the Querying the Reporting API guide.
diosmosis authored
13 ## Call the Piwik API using the HTTP API
cf168c1 Benaka Migrating Reporting API docs from piwik.org to developer.piwik.org. Adde...
diosmosis authored
14
080a797 Benaka Revising the Querying the Reporting API guide.
diosmosis authored
15 If you want to request data in any language (PHP, Python, Ruby, ASP, C++, Java, etc.) you can use the HTTP API. It is a simple way to request data via an HTTP GET.
cf168c1 Benaka Migrating Reporting API docs from piwik.org to developer.piwik.org. Adde...
diosmosis authored
16
080a797 Benaka Revising the Querying the Reporting API guide.
diosmosis authored
17 <div markdown="1" class="alert alert-warning">
18 **Security Notice**
cf168c1 Benaka Migrating Reporting API docs from piwik.org to developer.piwik.org. Adde...
diosmosis authored
19
080a797 Benaka Revising the Querying the Reporting API guide.
diosmosis authored
20 If the API call requires the token_auth and the HTTP request is sent over untrusted networks, we highly advise that you use an encrypted request. Otherwise, your token\_auth is exposed to eavesdroppers. This can be done using https instead of http. In the following example, replace the string "http" by "https".
21 </div>
22
23 You can, for example, get the top 100 search engine keywords used to find your website during the current week. Here is an example in PHP:
cf168c1 Benaka Migrating Reporting API docs from piwik.org to developer.piwik.org. Adde...
diosmosis authored
24
7f88b0e Matthieu Napoli #33 Support for {@include <url>} tags in Markdown to include remote file...
mnapoli authored
25 ```php
26 {@include escape https://raw.github.com/piwik/piwik/master/misc/others/api_rest_call.php}
27 ```
cf168c1 Benaka Migrating Reporting API docs from piwik.org to developer.piwik.org. Adde...
diosmosis authored
28
29 Here is the output of this code:
30
7f88b0e Matthieu Napoli #33 Support for {@include <url>} tags in Markdown to include remote file...
mnapoli authored
31 ```html
32 {@include escape http://piwik.org/wp-content/uploads/api_rest_call.php}
33 ```
cf168c1 Benaka Migrating Reporting API docs from piwik.org to developer.piwik.org. Adde...
diosmosis authored
34
72a4580 Matthieu Aubry Splitting tutorial back into its own page
mattab authored
35 ## Call the Piwik API in PHP
cf168c1 Benaka Migrating Reporting API docs from piwik.org to developer.piwik.org. Adde...
diosmosis authored
36
8c43807 Matthieu Napoli Added emphasis on a piece of text
mnapoli authored
37 If you want to request data in a PHP script **that is on the same server as Piwik**, you can use this simple technique. This is a more efficient solution as it doesn't require network calls. You directly call the PHP Piwik runtime and get the PHP data structure back.
cf168c1 Benaka Migrating Reporting API docs from piwik.org to developer.piwik.org. Adde...
diosmosis authored
38
080a797 Benaka Revising the Querying the Reporting API guide.
diosmosis authored
39 If you are developing a plugin, you should be using this technique.
cf168c1 Benaka Migrating Reporting API docs from piwik.org to developer.piwik.org. Adde...
diosmosis authored
40
7f88b0e Matthieu Napoli #33 Support for {@include <url>} tags in Markdown to include remote file...
mnapoli authored
41 ```php
42 {@include escape https://raw.github.com/piwik/piwik/master/misc/others/api_internal_call.php}
43 ```
cf168c1 Benaka Migrating Reporting API docs from piwik.org to developer.piwik.org. Adde...
diosmosis authored
44
45 Here is the output of this script:
46
7f88b0e Matthieu Napoli #33 Support for {@include <url>} tags in Markdown to include remote file...
mnapoli authored
47 ```xml
48 {@include escape http://demo.piwik.org/misc/others/api_internal_call.php}
f4fece9 Matthieu Napoli #22 Reviewed "Querying the reporting API"
mnapoli authored
49 ```
50
51 ## Learn more
52
f593920 Matthieu Napoli New guide listing the reporting API clients
mnapoli authored
53 To learn more about all the options available when calling the reporting API, read the [Reporting API reference](/api-reference/reporting-api).
54
55 You can also have a look at the [list of client libraries](/guides/reporting-api-clients) available to call the reporting API.
Something went wrong with that request. Please try again.