Skip to main content

Create View Event

Records that a specific content item was viewed by a user.

Endpoint​

POST /api/view-data

Authentication​

Authentication is optional. If provided, the view will be associated with the authenticated user. If not provided, the view will be recorded as anonymous.

Request Body​

ParameterTypeRequiredDescription
ContentIdintegerYesThe ID of the content that was viewed

Example:

{
"ContentId": 123
}

Response​

Success Response​

Code: 201 Created

No content is returned in the response body.

Error Response​

Code: 400 Bad Request

Content: {error}

Notes​

  • This endpoint should be called whenever a user views content
  • Views are tracked for analytics purposes and may affect content recommendations
  • Multiple views from the same user within a short time period may be deduplicated
  • Both authenticated and anonymous views are recorded, but authenticated views provide more valuable analytics
  • This endpoint is designed for high-volume usage and is optimized for performance

Example​

# Authenticated view
curl -X POST "https://api.tribesocial.io/api/view-data" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"ContentId": 123}'

# Anonymous view
curl -X POST "https://api.tribesocial.io/api/view-data" \
-H "Content-Type: application/json" \
-d '{"ContentId": 123}'