API EndpointsEntitiesIncrement Entity Views

Increment Entity Views

Endpoint

URL: /entities/:entityId/increment-views

Method: PATCH

Authentication Required: No


Description

This endpoint increments the view count of a specific entity by 1. It is typically triggered when a user visits or opens the entity. No authentication is required.


Request

Path Parameters

ParameterTypeRequiredDescription
entityIdstringYesThe unique ID of the entity.

Headers

None

Body Parameters

None

Example Request

PATCH /entities/abc123/increment-views

Response

Success Response (200 OK)

Returns the updated entity object with the incremented view count.

{
  "id": "abc123",
  "views": 21,
  "title": "Entity Title",
  ... other entity fields ...
}

Error Responses

Invalid Entity ID (400 Bad Request)

{
  "error": "Invalid entity ID.",
  "code": "entity/invalid-id"
}

Entity Not Found (404 Not Found)

{
  "error": "Entity not found.",
  "code": "entity/not-found"
}

Server Error (500 Internal Server Error)

{
  "error": "An error occurred while updating entity views.",
  "code": "entity/server-error",
  "details": "<error message>"
}

Notes

  • This endpoint is safe to call multiple times.