Updates 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 a basic representation of the file, with the updated shared link attached.
Returned when there is an incorrect permission combination
Returned when the access token provided in the Authorization
header
is not recognized or not provided.
Returned if the user does not have all the permissions to complete the update.
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.
Returns an error when the If-Match
header does not match
the current etag
value of the file. This indicates that the file
has changed since it was last requested.
An unexpected client error.
curl -i -X PUT "https://api.box.com/2.0/files/32423234?fields=shared_link" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-d '{
"shared_link": {
"access": "open",
"password": "mypassword",
"unshared_at": "2012-12-12T10:53:43-08:00",
"permissions": {
"can_download": false
}
}
}'
await client.sharedLinksFiles.updateSharedLinkOnFile(
fileId,
{
sharedLink: {
access:
'collaborators' as UpdateSharedLinkOnFileRequestBodySharedLinkAccessField,
} satisfies UpdateSharedLinkOnFileRequestBodySharedLinkField,
} satisfies UpdateSharedLinkOnFileRequestBody,
{ fields: 'shared_link' } satisfies UpdateSharedLinkOnFileQueryParams,
);
client.shared_links_files.update_shared_link_on_file(
file_id,
"shared_link",
shared_link=UpdateSharedLinkOnFileSharedLink(
access=UpdateSharedLinkOnFileSharedLinkAccessField.COLLABORATORS
),
)
await client.SharedLinksFiles.UpdateSharedLinkOnFileAsync(fileId: fileId, requestBody: new UpdateSharedLinkOnFileRequestBody() { SharedLink = new UpdateSharedLinkOnFileRequestBodySharedLinkField() { Access = UpdateSharedLinkOnFileRequestBodySharedLinkAccessField.Collaborators } }, queryParams: new UpdateSharedLinkOnFileQueryParams(fields: "shared_link"));
try await client.sharedLinksFiles.updateSharedLinkOnFile(fileId: fileId, requestBody: UpdateSharedLinkOnFileRequestBody(sharedLink: UpdateSharedLinkOnFileRequestBodySharedLinkField(access: UpdateSharedLinkOnFileRequestBodySharedLinkAccessField.collaborators)), queryParams: UpdateSharedLinkOnFileQueryParams(fields: "shared_link"))
BoxFile file = new BoxFile(api, "id");
BoxSharedLinkRequest sharedLinkRequest = new BoxSharedLinkRequest()
.access(OPEN)
.permissions(true, true);
BoxSharedLink sharedLink = file.createSharedLink(sharedLinkRequest);
{
"etag": "1",
"id": "12345",
"shared_link": {
"access": "open",
"download_count": 0,
"download_url": "https://app.box.com/shared/static/kwio6b4ovt1264rnfbyqo1.pdf",
"effective_access": "open",
"effective_permission": "can_download",
"is_password_enabled": false,
"permissions": {
"can_download": true,
"can_edit": true,
"can_preview": true
},
"preview_count": 0,
"unshared_at": "2020-09-21T10:34:41-07:00",
"url": "https://app.box.com/s/kwio6b4ovt1264rnfbyqo1",
"vanity_name": null,
"vanity_url": null
},
"type": "file"
}