Confluence page metadata.currentuser.viewed attribute behavior

Hi Team,

I have a question about Confluence’s page metadata handling. I have a forge application that depends on that attribute. I noticed that after a while, the api doesn’t show that the user have visited that page.
Example api call:

/wiki/rest/api/content/12025859/child/page?expand=metadata.currentuser.viewed

Call result:

{
"id": "12517377",
"type": "page",
"status": "current",
"title": "Fortified",
"macroRenderedOutput": {},
"metadata": {
"currentuser": {
"_expandable": {
"favourited": "",
"lastmodified": "",
"scheduled": "",
"lastcontributed": ""
}
},
"_expandable": {
"comments": "",
"sourceTemplateEntityId": "",
"simple": "",
"properties": "",
"frontend": "",
"labels": "",
"likes": ""
}
},
"extensions": {
"position": 235533834
},
"_expandable": {
"container": "/rest/api/space/P",
"restrictions": "/rest/api/content/12517377/restriction/byOperation",
"history": "/rest/api/content/12517377/history",
"body": "",
"version": "",
"descendants": "/rest/api/content/12517377/descendant",
"space": "/rest/api/space/P",
"childTypes": "",
"schedulePublishInfo": "",
"operations": "",
"schedulePublishDate": "",
"children": "/rest/api/content/12517377/child",
"ancestors": ""
},
"_links": {
"self": "https://nagyi-meta.atlassian.net/wiki/rest/api/content/12517377",
"tinyui": "/x/AQC-/",
"editui": "/pages/resumedraft.action?draftId=12517377",
"webui": "/spaces/P/pages/12517377/Fortified"
}
},

The user created that page, so the viewed attribute is missing. What’s the reason behind it?.

1 Like

I’ve noticed this too. I’ve assumed they must dump this after to a while to save on data storage or for performance reasons, so it can’t be relied on.

Today I noticed that it is returning this for a user who hasn’t read the article:

"metadata": {
                "currentuser": {
                    "viewed": {
                        "lastSeen": "2023-07-07T03:49:13.000Z",
                        "friendlyLastSeen": "less than a minute ago"
                    },
1 Like

I’ve also run into the same problem.
What I have noticed is that it always returns the lastSeen attribute regarding to the last person who has seen the page not the currentuser.
Any ideas what could I do with this problem?

1 Like