Join BoxWorks in San Francisco Nov 12-13! Keynotes, product demos, and Box Master Classes. Reserve your spot!

Getting Legal hold statistics using API

New post

Comments

1 comment

  • Chris Dascalos

    Hello Sai Vamsi,

    Would it be possible for you to share a bit more information on the overall goal of what you are trying to achieve so that the community can assist you?

    A Legal Hold could be applied to one or more users. In your above example, you are looking to create a Legal Hold and apply it to a single user. Are you looking for the results for just that single user or for the results of the Legal Hold for all of the users it has been applied to?

    If you make a GET request on your Legal Hold policy based off of the ID, you will be able to get the count information that you are looking for.

    [https://developer.box.com/reference/get-legal-hold-policies-id/]

    Once you have the count, you will have to make a decision on which direction you will want to go and how many API requests you would like to make. The path that I think would make sense based off of what I know from the above would be to use the List File Version Legal Holds API.

    [https://developer.box.com/reference/get-file-version-legal-holds/]

    Once you get the response and handle any pagination that may need to happen, you can loop through the results and determine your total byte size for the files and have both data points you are looking for.

    The more thorough answer would be to use a combination of the two new APIs that Box has released below in order to get your total byte size if you were to download the current file and every revision of the file that has existed to ensure that you can re-create the users steps assuming you need to do that which is why you are pursuing the legal hold in the first place.

    [https://developer.box.com/reference/get-legal-hold-policy-assignments-id-files-on-hold/]

    [https://developer.box.com/reference/get-legal-hold-policy-assignments-id-file-versions-on-hold/]

    Hopefully this helps and the more that you can share around the context of what you are trying to accomplish the more the community can help!

    Happy Coding!

    0
    Comment actions Permalink

Post is closed for comments.