Join BoxWorks 2024 to discover what's possible with content and AI!
Register now!Gets the information for a shared link on a file.
12345
The unique identifier that represents a file.
The ID for any file can be determined
by visiting a file in the web application
and copying the ID from the URL. For example,
for the URL https://*.app.box.com/files/123
the file_id
is 123
.
shared_link
Explicitly request the shared_link
fields
to be returned for this item.
Returns the base representation of a file with the additional shared link information.
Returned when the access token provided in the Authorization
header
is not recognized or not provided.
Returned if the file is not found, or the user does not have access to the file.
Returned if the file_id
is not in a recognized format.
An unexpected client error.
curl -i -X GET "https://api.box.com/2.0/files/32423234?fields=shared_link" \
-H "authorization: Bearer <ACCESS_TOKEN>"
BoxFile file = new BoxFile(api, "id");
BoxFile.Info info = file.getInfo()
BoxSharedLink link = info.getSharedLink()
String url = link.getUrl()
file_id = '11111'
shared_link = client.file(file_id).get().shared_link
url = shared_link['url']
client.files.get('11111', { fields: 'shared_link' })
.then(file => {
let url = file.shared_link.download_url
//...
})
client.files.getSharedLink(forFile: "11111") { (result: Result<SharedLink, BoxSDKError>) in
guard case let .success(sharedLink) = result else {
print("Error retrieving file shared link")
return
}
print("File shared link URL is \(sharedLink.url), with \(sharedLink.access) access")
}
{
"id": "12345",
"type": "file",
"etag": "1",
"shared_link": {
"url": "https://app.box.com/s/kwio6b4ovt1264rnfbyqo1",
"download_url": "https://app.box.com/shared/static/kwio6b4ovt1264rnfbyqo1.pdf",
"vanity_url": null,
"vanity_name": null,
"effective_access": "open",
"effective_permission": "can_download",
"is_password_enabled": false,
"unshared_at": "2020-09-21T10:34:41-07:00",
"download_count": 0,
"preview_count": 0,
"access": "open",
"permissions": {
"can_preview": true,
"can_download": true,
"can_edit": true
}
}
}