Skip to main content

Retrieve content blocks

Enterprise

This endpoint is part of Countly Enterprise. To get access, contact sales or compare versions. Existing customers can reach the support portal with questions.

Endpoint

/o/content
/o/content/by-id

Overview

Retrieves content blocks. Use /o/content to list blocks for an app, and /o/content/by-id to fetch one block.

Authentication

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

Permissions

  • Required permission: Read on the content feature

Request Parameters

ParameterTypeRequiredDescription
api_keyStringYes (or auth_token)API key for authentication
auth_tokenStringYes (or api_key)Auth token for authentication
app_idStringYesApplication identifier
_idStringYes for /o/content/by-idContent block ObjectID

Examples

Example 1: List Content Blocks

/o/content?api_key=YOUR_API_KEY&app_id=5be987d7b93798516eb5289a

Example 2: Get Content Block by ID

/o/content/by-id?api_key=YOUR_API_KEY&app_id=5be987d7b93798516eb5289a&_id=5d4472152de8f07336f3b352

Response

Success Response

List response (/o/content):

[
{
"_id": "507f1f77bcf86cd799439011",
"app": "5be987d7b93798516eb5289a",
"type": "modal",
"blocks": [],
"details": {
"title": "Welcome Modal",
"created": 1567474533960,
"updated": 1567474533960,
"creatorId": "5d4472152de8f07336f3b100",
"favorite": false,
"creator": "Jane Doe"
}
}
]

Single-item response (/o/content/by-id):

{
"_id": "507f1f77bcf86cd799439011",
"app": "5be987d7b93798516eb5289a",
"type": "modal",
"blocks": [],
"details": {
"title": "Welcome Modal",
"created": 1567474533960,
"updated": 1567474533960,
"creatorId": "5d4472152de8f07336f3b100",
"favorite": false
}
}

Response Fields

FieldTypeDescription
_idStringContent block ObjectID
appStringApplication identifier
typeStringContent type
blocksArrayBlock definitions as stored
detailsObjectMetadata
details.titleStringBlock title
details.createdNumberCreation timestamp
details.updatedNumberUpdate timestamp
details.creatorIdStringCreator member ID
details.favoriteBooleanFavorite flag
details.creatorStringCreator full name (added in /o/content list response)

Error Responses

HTTP StatusResponse
400"Missing _id parameter" (/o/content/by-id)
400"Invalid _id format" (/o/content/by-id)
404"Content not found" (/o/content/by-id)
500"Error"

Behavior

  1. /o/content lists blocks, sorted by details.created descending.
  2. /o/content enriches each block with creator full name from countly.members.
  3. /o/content/by-id returns a single block by _id and app.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.content_blocksEndpoint data source** - Content block definitions
countly.membersEndpoint data source** - Creator profile lookup for list endpoint