Aller au contenu

Notifications

Ce contenu n’est pas encore disponible dans votre langue.

The Notifications resource provides fake notification data with types, messages, and read status.

MethodEndpointDescription
GET/v1/notificationsList all notifications
GET/v1/notifications/:idGet a specific notification
{
"id": 1,
"userId": 1,
"type": "like",
"actorId": 2,
"entityId": 15,
"entityType": "social_post",
"message": "John Doe liked your post",
"read": false,
"createdAt": "2026-01-15T12:00:00.000Z"
}
Field Type Description
id number Unique identifier
userId number ID of the notification recipient
type string Notification type (like, comment, follow, mention)
actorId number ID of the user who triggered the notification
entityId number ID of the related entity
entityType string Type of the related entity (social_post, comment)
message string Notification message text
read boolean Whether the notification has been read
createdAt string ISO 8601 timestamp
Terminal window
curl https://api.phantomjson.app/v1/notifications
Parameter Type Default Description
page number 1 Page number
limit number 20 Items per page (max: 100)
sort string Sort field and direction
fields string Fields to return
userId number Filter by user ID
type string Filter by notification type
read boolean Filter by read status
{
"data": [
{
"id": 1,
"userId": 1,
"type": "like",
"actorId": 2,
"entityId": 15,
"entityType": "social_post",
"message": "John Doe liked your post",
"read": false,
"createdAt": "2026-01-15T12:00:00.000Z"
}
],
"meta": {
"total": 75,
"page": 1,
"limit": 20,
"totalPages": 4
}
}
Terminal window
curl https://api.phantomjson.app/v1/notifications/1
{
"data": {
"id": 1,
"userId": 1,
"type": "like",
"actorId": 2,
"entityId": 15,
"entityType": "social_post",
"message": "John Doe liked your post",
"read": false,
"createdAt": "2026-01-15T12:00:00.000Z"
}
}
Terminal window
curl "https://api.phantomjson.app/v1/notifications?userId=1"
Terminal window
curl "https://api.phantomjson.app/v1/notifications?type=like"
Terminal window
curl "https://api.phantomjson.app/v1/notifications?read=false"
Terminal window
# Newest first
curl "https://api.phantomjson.app/v1/notifications?sort=createdAt:desc"
# Oldest first
curl "https://api.phantomjson.app/v1/notifications?sort=createdAt:asc"
Terminal window
curl "https://api.phantomjson.app/v1/notifications?fields=id,type,message,read"
Terminal window
# Unread like notifications for user 1
curl "https://api.phantomjson.app/v1/notifications?userId=1&type=like&read=false&sort=createdAt:desc"
  • User — Each notification belongs to a user (userId)
  • Actor — Each notification may have an actor user (actorId)