Skip to main content
Question

Get SharedLink Info using the Java SDK

  • May 21, 2025
  • 2 replies
  • 4 views

Forum|alt.badge.img

Hello

 

I'd like to get Info of a Shared Link using its id.

Using the Java SDK I see that there is a BoxSharedLink object, but unlike other Box* objects, it doesn't have a constructor with the API connection and an Info getter.

 

Also, I see that there is a SharedLinkAPIConnection class, but using I see no way to retreive the BoxSharedLink representing the shared link's info.

 

Please assist

2 replies

Forum|alt.badge.img
private static BoxSharedLink createSharedLink(BoxAPIConnection api, String fileId) {
        BoxFile file = new BoxFile(api, fileId);
        BoxSharedLink.Permissions permissions = new BoxSharedLink.Permissions();
        permissions.setCanDownload(true);
        permissions.setCanPreview(true);
        Date date = new Date();

        Calendar unshareAt = Calendar.getInstance();
        unshareAt.setTime(date);
        unshareAt.add(Calendar.DATE, 14);

        BoxSharedLink sharedLink = file.createSharedLink(BoxSharedLink.Access.COMPANY, unshareAt.getTime(), permissions);
        logger.info("shared link: " + sharedLink.getURL());
        return  sharedLink;
    }

Forum|alt.badge.img

Thanks for the reply.

Perhaps my question needs clarification - 

I already have an existing id of an existing shared link.

I'd like to get info of that shared link.

Is that possible?