Choose content analytics filters
Populate category, author, creation-age and sorting controls for a publication's current content selection. The returned choices describe that selection; they are not reader records, activity totals or a complete taxonomy catalog.
| Task | Operation | Result |
|---|---|---|
| Get choices for the current selection | GET /api/v1/admin/content/analytics/filters | Four arrays: category, author, published and order |
Before you start
A resource is the selected publication. Supply its existing public key and an existing active staff session authorized there. Eligible roles are readonly, manager, support, admin and partner; root is also permitted. Service-account credentials are not supported. See credential transport.
| Header | Purpose | Required |
|---|---|---|
resource | Select the publication by public key | Yes |
token | Existing authorized staff session | Yes |
Accept: application/json | Request JSON responses | Used in the examples |
This GET takes query parameters and no body. All examples are synthetic and unexecuted. They use fictional category2101/author2201 and WALLKIT_API_BASE (scheme and host only, without a trailing slash or /api/v1), RESOURCE_KEY and STAFF_TOKEN. Clients are cURL, Node.js18+ native fetch in an .mjs file and Python3 standard-library urllib. See sample runtimes.
Get report choices
GET /api/v1/admin/content/analytics/filters
Start here to populate category and author selectors for the current report selection. The example selects content created within the thirty_days age choice. Use returned category and author IDs in their matching selection controls. The shared headers and prerequisites apply.
Send filter as JSON text in one query value, URL-encoded by the client. Here its decoded value is {"published":"thirty_days"}. The selection inputs define every supported field. Choices use the full current selection, including the facet being requested; list pagination does not limit them.
Request
curl --fail --silent --show-error --get \
"$WALLKIT_API_BASE/api/v1/admin/content/analytics/filters" \
--header 'Accept: application/json' \
--header "resource: $RESOURCE_KEY" \
--header "token: $STAFF_TOKEN" \
--data-urlencode 'filter={"published":"thirty_days"}'
try {
const url = new URL("/api/v1/admin/content/analytics/filters", process.env.WALLKIT_API_BASE);
url.searchParams.set("filter", JSON.stringify({ published: "thirty_days" }));
const response = await fetch(url, { headers: {
Accept: "application/json", resource: process.env.RESOURCE_KEY, token: process.env.STAFF_TOKEN
} });
if (response.status !== 200) throw new Error();
const choices = await response.json();
if (!choices || choices.error ||
!["category", "author", "published", "order"].every(key => Array.isArray(choices[key]))) {
throw new Error();
}
console.log(`Category choices: ${choices.category.length}`);
} catch {
console.error("Report choices unavailable. Check the publication, session and selection.");
process.exitCode = 1;
}
import json
import os
from urllib.parse import urlencode
from urllib.request import Request, urlopen
try:
query = urlencode({"filter": json.dumps({"published": "thirty_days"})})
url = os.environ["WALLKIT_API_BASE"] + "/api/v1/admin/content/analytics/filters?" + query
request = Request(url, headers={"Accept": "application/json",
"resource": os.environ["RESOURCE_KEY"], "token": os.environ["STAFF_TOKEN"]})
with urlopen(request) as response:
if response.status != 200:
raise ValueError()
choices = json.load(response)
if (not isinstance(choices, dict) or choices.get("error") or
not all(isinstance(choices.get(key), list)
for key in ("category", "author", "published", "order"))):
raise ValueError()
print("Category choices:", len(choices["category"]))
except Exception:
raise SystemExit("Report choices unavailable. Check the publication, session and selection.") from None
Successful response and fields
HTTP 200; complete synthetic response:
{
"category": [{"id": 2101, "title": "Culture"}],
"author": [{"id": 2201, "title": "Example editor"}],
"published": [
{"id": "one_day", "title": "1 day"},
{"id": "one_week", "title": "1 week"},
{"id": "thirty_days", "title": "30 days"},
{"id": "three_months", "title": "3 months"},
{"id": "six_months", "title": "6 months"}
],
"order": [
{"id": "published", "title": "Date/Time"},
{"id": "total_views", "title": "Total Views"},
{"id": "signups_count", "title": "Signups"},
{"id": "signups_percent", "title": "Signups (%)"},
{"id": "conversions_count", "title": "Conversions"},
{"id": "conversions_percent", "title": "Conversions (%)"}
]
}
| Field | Type and presence | Meaning |
|---|---|---|
category | Required array, possibly empty | Current category terms associated with matching stored-content records |
author | Required array, possibly empty | Current author terms associated with matching stored-content records |
category[].id, author[].id | Required integer | Term ID to use in its corresponding filter |
category[].title, author[].title | Required string or null | Current term label; null means no title is supplied |
published | Required array | The five fixed creation-age choices shown above |
order | Required array | The six fixed row-sorting choices shown above |
published[].id, order[].id | Required string | Exact input enum value shown above |
published[].title, order[].title | Required string | Display title shown above |
There is no items, paginator or selected/default-value echo. Category and author choices are selection-dependent, rather than a complete publication taxonomy catalogue.
When a choice disappears
For a selection with no matching stored content, a successful response can have the following partial excerpt; the fixed five published and six order entries still remain in the full response:
{"category": [], "author": []}
A narrow filter can remove choices, including choices for its own facet. To broaden the selection, remove a constraint and fetch choices again. For example, change {"category":[2101],"author":[2201],"published":"thirty_days"} to {"category":[2101],"published":"thirty_days"}. This removes the author constraint; it does not guarantee that choices will appear. Current classification changes and missing stored statistics can also affect which choices are available.
| HTTP status | API code/response shape | Cause | Next action |
|---|---|---|---|
| 200 | Empty category/author arrays | No matching terms in this selection | Remove a filter and request choices again; do not create taxonomy terms to repair the report |
| 409 | invalid_data; error_description: Error retrieve content analytics filters | Choice retrieval or parameter processing failed | Check JSON text and supported values; ask Wallkit if a valid selection still fails |
| Other status, unreadable JSON or unexpected shape | No usable choices | Request or response could not be used | Keep the selectors unavailable and follow shared recovery |
Next, populate your selection controls with these IDs and labels. If a filter changes, fetch choices for the new selection; do not keep treating an unavailable choice as a current match.
Selection inputs
This operation uses filter to select choices. It does not page or sort the returned choices using limit, page, order or sort, but supplied values must still validate. Omit those unused controls for this request.
| Input | Type / requirement | Meaning, constraints and omission default |
|---|---|---|
filter | Optional JSON text query value | A JSON object with the supported keys below; omitted means no category, author or creation-age restriction |
filter.category | Optional array of nonzero JSON integers | IDs from category choices; match any supplied category. Omitted or [] adds no category restriction |
filter.author | Optional array of nonzero JSON integers | IDs from author choices; match any supplied author. Omitted or [] adds no author restriction |
filter.published | Optional string | One of one_day, one_week, thirty_days, three_months, six_months; omitted adds no creation-age restriction |
limit | Optional integer, 1–100 | Page-size control; default 10, validated but unused for choices |
page | Optional positive integer | One-based page control; default 1, validated but unused for choices |
order | Optional string | One of the six returned order[].id values; default published; validated but unused for choices |
sort | Optional string | Lowercase asc or desc; default asc; validated but unused for choices |
Use integers such as 2101, rather than strings such as "2101", for term IDs. Category and author constraints combine: a record must match both supplied groups. Use only the documented object shape; bracket-style filter parameters are not the format shown here. Omit an unused property rather than substituting null, false or an empty string.
Despite its name, published filters the calendar date of content creation, relative to the selected age interval. It is not a start/end window for access activity. No timezone conversion or UTC designation is supplied. Only content with stored statistics and current matching content participates; missing choices do not establish zero activity or an empty publication taxonomy.
Shared recovery
These checks cover the caller and selected publication. Structured errors use error (code), nullable error_description and req_guid (request reference). They are separate from successful operation payloads; not every failure has this envelope.
| HTTP status | API code/response shape | Cause | Next action |
|---|---|---|---|
| 404 | resource_not_exists | Selected publication could not be resolved | Check its public key and integration context with the administrator |
| 401 | auth_failed, token_expired or token_compromised | Caller/session is absent or unusable | Obtain a valid authorized session through the existing sign-in process |
| 401 | auth_access_fail | Caller is inactive or access is locked/suspended | Ask the administrator to review caller/publication access |
| 401 or 403 | access | Caller does not meet the access requirements | Ask the administrator to confirm the caller's grant; changing filters does not grant access |
| 409 | initialize_failed | Request context initialization failed | Confirm publication/session context; give Wallkit the request reference if supplied |
| Transport failure, other status or unreadable body | No usable choices | Retrieval did not produce a usable successful payload | Show unavailable; keep credentials and raw failure content out of logs and seek help if persistent |