Notifications
Notifications allow you to send/receive messages to/from other users of the platform.
The notifications Object
| Field Name | Type | Description |
|---|---|---|
id | integer | Primary key of the notification. |
timestamp | datetime | Timestamp in ISO8601 when the notification was created. |
status | string | Current status of the notification. One of "inbox", "archived". |
recipient | object | User that received the notification. Many-to-one relationship to users. |
sender | object | User that sent the notification, if any. Many-to-one relationship to users. |
subject | string | Subject line of the message. |
message | string | Notification's message content. Will be sent in the email. |
collection | string | Collection this notification references. |
item | string | Primary key of the item this notification references. |
List Notifications
List all notifications that exist in TrackVision.
Request
- REST
- GraphQL
GET /notifications
SEARCH /notifications
If using SEARCH you can provide a query object as the body of your request.
POST /graphql/system
type Query {
notifications: [trackvision_notifications]
}
Query Parameters
Supports all global query parameters.
Response
An array of up to limit notification objects. If no items are available, data will be an empty array.
Example
- REST
- GraphQL
GET /notifications
SEARCH /notifications
POST /graphql/system
query {
notifications {
id
recipient
subject
}
}
Retrieve a notification
List an existing notification by primary key.
Request
- REST
- GraphQL
GET /notifications/:id
POST /graphql/system
type Query {
notifications_by_id(id: ID!): trackvision_notifications
}
Query Parameters
Supports all global query parameters.
Response
Returns the requested notification object.
Example
- REST
- GraphQL
GET /notifications/42
query {
notifications_by_id(id: 42) {
id
sender
recipient
message
subject
}
}
Create a Notification
Create a new notification.
Request
- REST
- GraphQL
POST /notifications
Provide a notification object as the body of your request.
POST /graphql/system
type Mutation {
create_notifications_item(data: create_trackvision_notifications_input!): trackvision_notifications
}
Query Parameters
Supports all global query parameters.
Request Body
A partial notification object.
Response
Returns the notification object for the created notification.
Example
- REST
- GraphQL
POST /notifications
{
"recipient": "410b5772-e63f-4ae6-9ea2-39c3a31bd6ca",
"subject": "Hi there!"
}
POST /graphql/system
mutation {
create_notifications_item(data: { recipient: "410b5772-e63f-4ae6-9ea2-39c3a31bd6ca", subject: "Hi there!" }) {
id
recipient
}
}
Create Multiple Notifications
Create multiple new notifications.
Request
- REST
- GraphQL
POST /notifications
Provide an array of notification objects as the body of your request.
POST /graphql/system
type Mutation {
create_notifications_items(data: [create_trackvision_notifications_input!]!): [trackvision_notifications]
}
Query Parameters
Supports all global query parameters.
Request Body
An array of partial notification objects.
Response
Returns the notification object for the created notification.
Example
- REST
- GraphQL
POST /notifications
[
{
"collection": "trackvision_files",
"recipient": "410b5772-e63f-4ae6-9ea2-39c3a31bd6ca",
"message": "Hi there! You should check out these files"
},
{
"collection": "articles",
"recipient": "410b5772-e63f-4ae6-9ea2-39c3a31bd6ca",
"message": "Hi there! You should check out these articles"
}
]
POST /graphql/system
mutation {
create_notifications_items(
data: [
{
collection: "trackvision_files"
recipient: "410b5772-e63f-4ae6-9ea2-39c3a31bd6ca"
message: "Hi there! You should check out these files"
}
{
collection: "articles"
recipient: "410b5772-e63f-4ae6-9ea2-39c3a31bd6ca"
message: "Hi there! You should check out these articles"
}
]
) {
id
recipient
}
}
Update a Notification
Update an existing notification.
Emails are only sent when the notification is created. Updated to an existing notification won't trigger a new notification email to be sent.
Request
- REST
- GraphQL
PATCH /notifications/:id
Provide a partial notification object as the body of your request.
POST /graphql/system
type Mutation {
update_notifications_item(id: ID!, data: update_trackvision_notifications_input): trackvision_notifications
}
Query Parameters
Supports all global query parameters.
Request Body
A partial notification object.
Response
Returns the notification object for the updated notification.
Example
- REST
- GraphQL
PATCH /notifications/34
{
"message": "This is my updated notification"
}
POST /graphql/system
mutation {
update_notifications_item(id: 32, data: { message: "This is my updated notification" }) {
id
message
}
}
Update Multiple Notifications
Update multiple existing notifications.
Request
- REST
- GraphQL
PATCH /notifications
{
"keys": notification_id_array,
"data": partial_notification_object
}
POST /graphql/system
type Mutation {
update_notifications_items(ids: [ID!]!, data: update_trackvision_notifications_input): [trackvision_notifications]
}
Query Parameters
Supports all global query parameters.
Request Body
keys Required
Array of primary keys of the notifications you'd like to update.
data Required
Any of the notification object's properties.
Response
Returns the notification objects for the updated notifications.
Example
- REST
- GraphQL
PATCH /notifications
{
"keys": [15, 64],
"data": {
"message": "Updated message!"
}
}
POST /graphql/system
mutation {
update_notifications_items(ids: [15, 64], data: { message: "Updated message!" }) {
id
recipient
}
}
Delete a Notification
Delete an existing notification.
Request
- REST
- GraphQL
DELETE /notifications/:id
POST /graphql/system
type Mutation {
delete_notifications_item(id: ID!): delete_one
}
Response
Empty body.
Example
- REST
- GraphQL
DELETE /notifications/34
POST /graphql/system
mutation {
delete_notifications_item(id: 32) {
id
}
}
Delete Multiple Notifications
Delete multiple existing notifications.
Request
- REST
- GraphQL
DELETE /notifications
Provide an array of notification IDs as your request body.
POST /graphql/system
type Mutation {
delete_notifications_items(ids: [ID!]!): delete_many
}
Request Body
An array of notification primary keys
Response
Empty body.
Example
- REST
- GraphQL
DELETE /notifications
[15, 251, 810]
POST /graphql/system
mutation {
delete_notifications_items(ids: [15, 251, 810]) {
ids
}
}