shared link details using box api
Hello Experts,
I have one question related to shared links. When I tried to share a folder box showing an error to that user or the group is not collabrated with the folder.
So I have first collabrated the file with a user.
Shared the folder to the user.
Now when I am reading shared event using box api i got the following results.
{ "source": { "item_type": "file", "item_id": "", "item_name": "testng.xml", "parent": { "type": "folder", "name": "All Files", "id": "0" } }, "created_by": { "type": "user", "id": "", "name": "User1", "login": "***@example.com" }, "created_at": "20**removed**T14:30:**removed**:00", "event_id": "01194f**removed**f5d-47c0-b628-ca2685858a31", "event_type": "SHARE", "ip_address": "", "type": "event", "session_id": null, "additional_details": { "shared_link_id": "ylzyeqkocg3njnlp4l3k95n5uhdt7myj", "version_id": "removed for privacy73", "service_id": "191753", "service_name": "BoxApplication" } }
If you look at the output there is no information to whom I have shared the file. Is there any way that I can get this information. If single api does not respond is there any detail api to find to whon and when the file shared so that I can map them Please let me know.
-
Hi ,
If you are looking for whom the folder or file is being shared using "shared_link" then, there is no way to get it BUT if you are looking for a way to get the collaborator/s on that specific folder then you have to do the following:
- Run this on the folder with the folder_ID
curl https://api.box.com/2.0/folders/FOLDER_ID/collaborations \ -H "Authorization: Bearer ACCESS_TOKEN"
- As a result you will get a collaboration ID or IDs associated with the folder.
"type": "collaboration", "id": "14176246",
- In this step use those collaboration IDs to get the individual collaborator name, login and type:
curl https://api.box.com/2.0/collaborations/COLLAB_ID \ -H "Authorization: Bearer ACCESS_TOKEN"
- sample result
accessible_by": { "type": "user", "id": "18203124", "name": "sean", "login": "***@example.com" }
Hope this helps.
thanks,
Bibek
- Run this on the folder with the folder_ID
Please sign in to leave a comment.
Comments
2 comments