Skip to content

Queue a priority analytics refresh

PubNio API analytics.refreshes.create: queue a priority analytics refresh. Request fields, examples in five clients, errors, and idempotency.

Queue a priority analytics refresh with POST /api/v1/analytics/refreshes. Requires an API key with the read scope or a signed-in workspace member.

Request

Marks an existing published post cursor due now and returns 202. Repeating the request coalesces on the same refresh ID. No provider call happens in the request.

Body field Type Required
workspaceId UUID Yes
postId UUID No
targetId UUID No
metrics array of one of 20 strings No

Response

  • HTTP 202: AnalyticsRefresh with id, workspaceId, subjectKind, subjectId, status, nextDueAt, lastSuccessAt, errorKind, createdAt.
    • status: queued, running, succeeded, failed, paused, deleted, inaccessible

The OpenAPI document has each field’s type.

Examples

const refresh = await workspace.analytics.refresh({ postId });
refresh = workspace.analytics.create_refresh(post_id=post_id)
curl -X POST "https://pubnio.com/api/v1/analytics/refreshes" \
  -H "Authorization: Bearer $PUBNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"workspaceId":"'"$WORKSPACE_ID"'","postId":"'"$POST_ID"'"}'
pnio analytics refreshes create --workspace-id "$WORKSPACE_ID" --post-id "$POST_ID"
async () => {
  const postId = "<postId>";
  const response = await codemode.request({
    method: "POST",
    path: "/api/v1/analytics/refreshes",
    body: { workspaceId: codemode.workspaceId, postId: postId },
  });
  return response.data;
};

Errors

It declares no problem of its own.

It declares the problems every Analytics operation and most operations declare.

Idempotency

No key, so a retried POST is not deduplicated. Read the current state before you retry.

Limits

Type to search…

↑↓ navigate↵ selectEsc close