Get item activity stats by interval not working

Saintenr 21 Reputation points
2021-11-01T07:09:25.53+00:00

the api is not working for me. We are using SPO from Germany and trying to get the activity for some documents stored in on of our libraries.

https://xxx.sharepoint.com/_api/v2.1/sites/xxx.sharepoint.com/lists/{our-library-id}/items/209/getActivitiesByInterval(startDateTime='2021-09-01',endDateTime='2021-12-31',interval='month')

It gave us the response: Item not found ->
{"error":{"code":"itemNotFound","message":"Item not found"}}

i tried the id 209 of the document. I also tried the "DocId" and "UniqueId"...

which document id is required here?

an explaination of what we are want to achieve:
We want an overview of every document stored on our Libraries, with the number of views of each document.

Thanks. Saintenr

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,565 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,655 questions
0 comments No comments
{count} votes

Accepted answer
  1. MichaelHan-MSFT 18,016 Reputation points
    2021-11-02T03:09:19.257+00:00

    Hi @Saintenr ,

    Per my test, I got the same result as yours. It should be the id of the document, when i use the api https://xxx.sharepoint.com/_api/v2.1/sites/xxx.sharepoint.com/lists/{our-library-id}/items/209, I could get the result for that specific document.

    If I add the getActivitiesByInterval in the end, I would get the Item not found error as yours.

    Currently, the Get item activity stats by interval api seems not work for using list/<list-id>/items/<item-id>. As a workaround, you could use /drives/{drive-id}/items/{item-id}. This would work for you.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



0 additional answers

Sort by: Most helpful