GET /:project/activity
# Activity
All events that happen within Directus are tracked and stored in the activities collection. This gives you full accountability over everything that happens.
# The Activity Object
# Attributes
# id integer
Unique identifier for the object.
# action string
Action that was performed. One of authenticate
, comment
, upload
, create
, update
, delete
, soft-delete
, revert
, status-update
, invalid-credentials
.
# action_by integer
Unique identifier of the user account who caused this action.
# action_on string (datetime)
When the action happened.
# ip string
The IP address of the user at the time the action took place.
# user_agent string
User agent string of the browser the user used when the action took place.
# collection string
Collection identifier in which the item resides.
# item string
Unique identifier for the item the action applied to. This is always a string, even for integer primary keys.
# edited_on string (datetime)
When the action record was edited. This currently only applies to comments, as activity records can't be modified.
# comment string
User comment. This will store the comments that show up in the right sidebar of the item edit page in the admin app.
# comment_deleted_on string (datetime)
When and if the comment was (soft-)deleted.
# List Activity Actions
Returns a list of activity actions.
# Parameters
# project required
The project you're targetting.
# Query
# fields optional
Control what fields are being returned in the object. Learn more
# limit optional
A limit on the number of objects that are returned. Default is 200
. Learn more
# meta optional
What metadata to return in the response. Learn more
# offset optional
How many items to skip when fetching data. Default is 0
. Learn more
# single optional
Return the result as if it was a single item. Useful for selecting a single item based on filters and search queries. Will force limit
to be 1. Learn more
# sort optional
How to sort the returned items. Learn more
# filter optional
Select items in collection by given conditions. Learn more
# q optional
Filter by items that contain the given search query in one of their fields. Learn more
# Returns
An object with a data
property that contains an array of up to limit
activity objects. If no items are available, data
will be an empty array.
{
"data": [
{
"id": 1,
"action": "update",
"action_by": 1,
"action_on": "2019-12-05T22:52:09+00:00",
"ip": "127.0.0.1",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36",
"collection": "directus_fields",
"item": "328",
"edited_on": null,
"comment": null,
"comment_deleted_on": null
},
{ ... },
{ ... }
]
}
# Retrieve an Activity Action
Retrieves the details of an existing activity action. Provide the primary key of the activity action and Directus will return the corresponding information.
# Parameters
# Query
# fields optional
Control what fields are being returned in the object. Learn more
# meta optional
What metadata to return in the response. Learn more
# Returns
Returns an activity object if a valid identifier was provided.
GET /:project/activity/:id
{
"data": {
"id": 15,
"action": "update",
"action_by": 1,
"action_on": "2019-12-06T00:49:16+00:00",
"ip": "127.0.0.1",
"user_agent": "Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/78.0.3904.108 Safari\/537.36",
"collection": "directus_fields",
"item": "325",
"edited_on": null,
"comment": null,
"comment_deleted_on": null
}
}
# Create a Comment
Creates a new comment.
# Parameters
# project required
The project you're targetting.
# Attributes
# collection required
Parent collection of the item you want to comment on.
# id required
Unique identifier of the item you want to comment on.
# comment required
The comment to post on the item.
# Query
# meta optional
What metadata to return in the response. Learn more
# Returns
Returns the activity object of the created comment.
POST /:project/activity/comment
{
"collection": "projects",
"item": 1,
"comment": "A new comment"
}
{
"data": {
"id": 23,
"action": "comment",
"action_by": 1,
"action_on": "2020-01-10T20:37:01+00:00",
"ip": "172.18.0.6",
"user_agent": "Paw\/3.1.10 (Macintosh; OS X\/10.15.2) GCDHTTPRequest",
"collection": "many",
"item": "1",
"edited_on": null,
"comment": "My new comment",
"comment_deleted_on": null
}
}
# Update a Comment
Update the content of an existing comment.
# Parameters
# Attributes
# comment required
The updated comment text.
# Query
# meta optional
What metadata to return in the response. Learn more
# Returns
Returns the activity object of the updated comment.
PATCH /:project/activity/comment/:id
{
"comment": "My updated comment"
}
{
"data": {
"id": 23,
"action": "comment",
"action_by": 1,
"action_on": "2020-01-10T20:37:01+00:00",
"ip": "172.18.0.6",
"user_agent": "Paw\/3.1.10 (Macintosh; OS X\/10.15.2) GCDHTTPRequest",
"collection": "many",
"item": "1",
"edited_on": "2020-01-10T20:37:17+00:00",
"comment": "My updated comment",
"comment_deleted_on": null
}
}