Skip to main content

setFileExternalLink

FileShareWrapper setFileExternalLink(id, FileLinkRequest)

PUT /api/2.0/files/file/{id}/links

Set a file external link

Creates an external link to a file, or changes or revokes an existing one, and answers with the link as it now stands. linkId decides which: an identifier that is not yet in use, the empty one included, creates a link, while the identifier of an existing link rewrites it, so the whole set of parameters is applied every time and a field left out is reset rather than kept. access carries the rights the link grants, and access set to the value that denies everything revokes the link instead - the answer is then empty, and a revoked primary link is not recreated by a later read. title names the link for the people who manage it, expirationDate limits its lifetime and is refused when it lies more than a few years ahead, password asks visitors for a secret, denyDownload leaves them with viewing only, internal admits signed-in members alone, and primary=true makes it the primary link of the file. The caller needs the right to share the file and is otherwise refused, an unknown file being answered as not found. The call is mutating.

Parameters​

NameInTypeDescriptionNotes
idpathInteger (int32)The file the link points at.[required] [example: 1]
FileLinkRequestbodyFileLinkRequestThe settings of the link. They are applied in full, so a field left out is reset rather than kept.[required]

Responses​

Status codeDescriptionTypeResponse headers
200The link as it now stands, or nothing when it was revokedFileShareWrapperX-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
400The title or password is longer than 255 characters, the password does not meet the portal password policy, or expirationDate lies more than 10 years ahead--
403The caller may not share the file, the access level is not available for links to this file, the link limit is reached, or the admin's restriction on external links forbids the change--
404The file id resolves to nothing--
401UnauthorizedErrorApiResponse-
429Too Many Requests.ErrorApiResponseRetry-After
500Internal Server Error.ErrorApiResponse-
502Bad Gateway. Returned by the reverse proxy, response body may be HTML and not JSON.--
503Service Unavailable. Returned by the reverse proxy, response body may be HTML and not JSON.--

Return type​

FileShareWrapper

Third-party storage​

For a file or folder in a connected third-party storage the identifier is a string such as sbox-42, and the call differs in these parts only:

NameInTypeDescriptionNotes
idpathStringThe file the link points at.[required] [example: sbox-42-L1JlcG9ydC5kb2N4]

Authorization​

Basic, OAuth2 (scopes: read, write), ApiKeyBearer, asc_auth_key, Bearer, OpenId

HTTP request headers​

  • Content-Type: application/json
  • Accept: application/json