How to get create/update time

Is it possible to get create/update time of elements, especially Document type?

Hi @Amerehei,

If you want to get information about when an element was created and/or updated you can use the activities query, and then can filter the results to look for create/update time for an elementId and/or elementType (ie: Document)

For example, to query a workspace to look for when a specific element of type Document was either created or updated:

query getActivities($workspaceId: ID!, $filter:ActivityFilter!){
    activities(workspaceId: $workspaceId, filter:$filter ) {
        results{
            __typename
            workspaceId
            id
            actorUserIds:actorIds
            ... on CreateElementActivity{
                activityId:id
                createElements:elements{
                    id
                    type
                }
                timespan{
                    createELementStart:start
                    createELementEnd:end
                }
            }

            ... on UpdateElementActivity{
                id
                updateElements:elements{
                    id
                    type
                }
                timespan{
                    UpdateElementActivityStart:start
                    UpdateElementActivityEnd:end
                }
            }
        }
    }
}

variables with filter to filter for specific elementId, created/updated, and type Document:

{
    "workspaceId": "{{workspaceID}}",
    "filter": {
        "selectors": [
            {
                "workspaceContentActivity": {
                    "elementId": "65272dd55ce8b718906906cb",
                    "activityType": ["Created", "Updated"],
                    "elementType": "Document"
                }
            }
        ]
    }
}

with response:

{
    "data": {
        "activities": {
            "results": [
                {
                    "__typename": "CreateElementActivity",
                    "workspaceId": "bEu943lPQw7XWeh1pPHN",
                    "id": "65272fb04234375cfdf28472",
                    "actorUserIds": [
                        "BC0i0wzZ5Caph7i871Ka"
                    ],
                    "activityId": "65272fb04234375cfdf28472",
                    "createElements": [
                        {
                            "id": "65272dd55ce8b718906906cb",
                            "type": "Document"
                        }
                    ],
                    "timespan": {
                        "createELementStart": "2023-10-11T23:21:01.078Z",
                        "createELementEnd": "2023-10-11T23:21:01.078Z"
                    }
                }
            ]
        }
    }
}

You can explore the filtering options in our documentation, but if you have any additional questions, please let us know.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.