Skip to main content

Update content block

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​

/i/content/save

Overview​

Updates an existing content block when content_id is provided.

Authentication​

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

Permissions​

  • Required permission: Update 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
content_idStringYesContent block ObjectID to update
typeStringYesContent block type
blocksStringYesJSON stringified array of block objects
detailsStringYesJSON stringified object with metadata (created, creatorId, favorite, title)

Examples​

Example 1: Update Request​

/i/content/save?api_key=YOUR_API_KEY&app_id=5be987d7b93798516eb5289a&content_id=5d4472152de8f07336f3b352&type=modal&blocks=<JSON_STRING>&details=<JSON_STRING>

blocks object before stringifying:

[
{
"layout": "modal",
"elements": {
"title": {
"text": "Updated Welcome"
}
}
}
]

details object before stringifying:

{
"title": "Updated Welcome Modal",
"creatorId": "5d4472152de8f07336f3b100",
"favorite": true,
"created": 1567474533960
}

Response​

Success Response​

{
"status": "Success",
"contentId": "507f1f77bcf86cd799439011"
}

Response Fields​

FieldTypeDescription
statusStringOperation status
contentIdStringUpdated content block ID

Error Responses​

HTTP StatusResponse
400JSON parsing error or "Invalid request"
400Validation/processing error message (e.message)
500"Error"

Behavior​

  1. Uses branch when content_id is present.
  2. Parses blocks and details from JSON strings.
  3. Updates the document by _id + app.
  4. Uses upsert: true in update operation.
  5. Returns status and contentId.

Limitations​

  • Entire blocks payload is replaced by provided value.
  • Update path is implemented with upsert behavior.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.content_blocksEndpoint data source** - Content block definitions