This top-level API aggregates the so-called content keyword documents (content profiles), associated with a given site or set of sites, and computes various metrics for a specified slice of data. The slice is defined by combining filters. Filters can be defined for keywords in content profiles. This API is useful for answering questions such as "find the number of unique sports pages mentioning Donald Trump", where "sports pages mentioning Donald Trump" are the subject to filtering and the requested result is a set of metrics, i.e., the number of unique pages.
The user must be authenticated and have read permissions to the specified sites.
Request
The request object has the following fields:
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
Array of String |
No |
The set of sites to aggregate over. |
|
|
String |
No |
The site to aggregate over. A more convenient alternative to |
|
|
Array of String |
No |
The set of site groups to aggregate over. |
|
|
String |
No |
The site group to aggregate over. A more convenient alternative to |
|
|
Array of Object |
No |
Filters to be applied. Conjunctive semantics ( |
Fields
Fields specify which metrics to aggregate. Currently, the following fields are supported:
|
Name |
Implicit |
Description |
|---|---|---|
|
|
Yes |
The number of unique pages (i.e. content profiles, i.e. keyword documents). |
Response
The response object has the following fields:
|
Name |
Type |
Description |
|---|---|---|
|
|
Object |
The field names and aggregated numbers. |
Examples
The number of unique pages mentioning Donald Trump
$ python cx.py /content/keyword '{"siteId":"12345", "filters":[{"type":"keyword","group":"person","item":"Trump"}]}'
{
"data": {
"urls": 1777
}
}
The number of unique pages associated with football in some way
$ python cx.py /content/keyword '{"siteId":"12345", "fields":["urls"], "filters":[{"type":"keyword","group":"term","item":"football"}]}'
{
"data": {
"urls": 93
}
}
The number of unique pages associated with football, but with filters defined in a segment
$ python cx.py /content/keyword '{"siteId":"12345", "filters":[{"type":"segment","item":"<football_segment_id>"}]}}'
{
"data": {
"urls": 93
}
}
The number of unique pages associated with football, or mentioning Donald Trump
$ python cx.py /content/keyword '{"siteIds":["12345"], "filters":[{"type":"or", "filters":[{"type":"keyword","group":"term","item":"football"},{"type":"keyword","group":"person","item":"Trump"}]}]}'
{
"start": 1416291900,
"stop": 1416295500,
"data": {
"urls": 1870
}
}