Skip to main content

/recent_items API interaction_type only returns "item_preview"

  • November 10, 2023
  • 2 replies
  • 137 views

I’m using the /recent_items to identify the following:



  • item_modify, where a user has modified a file in Box

  • item_preview, where a user has viewed a preview of a file

  • item_upload, where a user has uploaded a file

  • item_comment, where a user has added a comment to a file


I have created a folder & file, created a folder & uploaded a file, and added comments to the file in my box account. However, the response only lists files interacted with interaction_type = “item_preview”? I was expecting the API to return the interaction_type = “item_uploaded” when the file was uploaded; and return the interaction_type = “item_comment” when a comment was added the file?


Any help is greatly appreciated. Thx

2 replies

CodeBoxSeb
  • Participating Frequently
  • 58 replies
  • November 13, 2023

Welcome to the forum, @lfrias !


I think the Recent items endpoint only retrieves files that have been previewed by the user.


If you need to check files that been uploaded or commented, you should use the Events endpoint instead :


rbarbosa Box
  • Developer Advocate
  • 553 replies
  • November 13, 2023

Hi @lfrias


The expected behavior is to return the last interaction of the user with the file.


Did a quick test on my account:


curl --location 'https://api.box.com/2.0/recent_items?fields=id%2Ctype%2Cname' \

--header 'Authorization: Bearer q3...cx' \


Resulted in:


{

    "next_marker": "",

    "limit": 100,

    "order": {

        "by": "interacted_at",

        "direction": "DESC"

    },

    "entries": [

        {

            "type": "recent_item",

            "interaction_type": "item_upload",

            "interacted_at": "2023-11-13T08:35:22-08:00",

            "item": {...},

            "interaction_shared_link": null

        },

        {

            "type": "recent_item",

            "interaction_type": "item_preview",

            "interacted_at": "2023-11-10T08:16:50-08:00",

            "item": {... },

            "interaction_shared_link": null

        },

    ]

}


I’m getting more than just item_preview .


Let us know if this helps.


Cheers


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings