Create File Applink
/documents/api/1.1/applinks/file/{fileId}
Create an applink for a specified file and a specified user.
You can grant the specified user any standard role except manager or owner:
- Viewer: Viewers can look at files and folders, but can't change things.
- Downloader: Downloaders can also download files and save them to their own computers.
- Contributor: Contributors can also modify files, update files, upload new files, and delete files.
Note:
To create an applink, the requester must have admin privileges for the file. That is, the requester must be the owner or have the manager role.
Request
- application/json
- application/xml
- fileId
-
Type:
string
Required:true
Globally unique identifier (GUID) for the folder.
The request body defines the details of the create applink request. Bold indicates a required value.
The request body defines the details of the create applink request. Bold indicates a required value.
- assignedUser
-
Type:
string
Required:true
Identifier for the user. This can be a globally unique identifier (GUID) or some other identifier. - role
-
Type:
string
Allowed Values:[ "viewer", "downloader", "contributor", "manager" ]
Access level for the shared item (role keywords must be lowercase):
- viewer (default)
- downloader
- contributor
- manager
- userLocale
-
Type:
string
Locale used for the applink. Locale can affect how values, such as time, are represented. - userTimeZone
-
Type:
string
Time zone used for the applink. The time zone can affect how time values are interpreted.
Example application/json
{
"assignedUser":"U0EAA20910FAF3052ACB79E4T00000000001",
"role":"manager",
"userLocale":"Dansk",
"userTimeZone":"Canada/Pacific"
}
Response
- application/json
- application/xml
The request was fulfilled.
- accessToken
-
Type:
string
This element provides access to the resource and expires after 15 minutes. You can refresh the access token any number of times within the time period defined by the refresh token (24 hours). - appLinkID
-
Type:
string
This element uniquely identifies the resource. - appLinkUrl
-
Type:
string
The URL of the resource. - errorCode
-
Type:
string
An error code of zero (0) indicates no errors. - id
-
Type:
string
Globally unique identifier (GUID) for the shared item. - refreshToken
-
Type:
string
This element enables you to request a new access token when the current access token expires. The refreshed token expires after 24 hours. - role
-
Type:
string
Access level for the shared item. - type
-
Type:
string
Item typeapplink
.
Example application/json
{
"appLinkID":"LDhsn4VPTsnDnKpKLFZTCkjaPkYbMC6-3taYSdJAazckhezJ2HlSjs2THOou6cCAvxcRnw5gpXcU7pIRkCmWN8kEToJHFwwZ-ptWvPGhJaiirl9baL9mka14WnwpL6auOO40-gFMPvkPv23OtMnj2W3A==",
"accessToken":"GYrSN5zuj0kOTE4k_60bKvdkxx2-ARA546A2T77GtEOgoPZPGgKk126OeCn1w-Ij",
"appLinkUrl":"http://www.example.com/documents/embed/link/app/LDhsn4VPTsnDnKpKLFZTCkjaPkYbMC6-3taYSdJAazckhezJ2HlSjs2THOou6cCAvxcRnw5gpXcU7pIRkCmWN8kEToJHFwwZ-ptWvPGhJaiirl9baL9mka14WnwpL6auOO40-gFMPvkPv23OtMnj2W3A==/fileview/DFD11F62E911327CB1F160F6T0000000000100000001",
"refreshToken":"Yc_b_dE8V03eDTCmcmC1gi_y3LVJTPiZOSQDhuS_VWim9E_FRpLQGtEhgxCNbKTG",
"role":"manager",
"id":"DFD11F62E911327CB1F160F6T0000000000100000001",
"type":"applink",
"errorCode":"0"
}
Request parameters are not formatted correctly.
Forbidden if the user does not have read permission.
File ID is not found.
Examples
The following example grants manager-level access to the specified user for the specified file.
POST .../applinks/file/DFD11F62E911327CB1F160F6T0000000000100000001
Request Header
None.
Request Body
{ "assignedUser": "U0EAA20910FAF3052ACB79E4T00000000001", "role": "manager", "userLocale": "Japanese" }
HTTP Status Code
HTTP_STATUS = 200
JSON Response
{ "accessToken": "GYrSN5zuj0kOTE4k_60bKvdkxx2-ARA546A2T77GtEOgoPZPGgKk126OeCn1w-Ij", "appLinkID": "LDhsn4VPTsnDnKpKLFZTCkjaPkYbMC6-3taYSdJAazckhezJ2HlSjs2THOou6cCAvxcRnw5gpXcU7pIRkCmWN8kEToJHFwwZ-ptWvPGhJaiirl9baL9mka14WnwpL6auOO40-gFMPvkPv23OtMnj2W3A==", "appLinkUrl": "http://www.example.com/documents/embed/link/app/LDhsn4VPTsnDnKpKLFZTCkjaPkYbMC6-3taYSdJAazckhezJ2HlSjs2THOou6cCAvxcRnw5gpXcU7pIRkCmWN8kEToJHFwwZ-ptWvPGhJaiirl9baL9mka14WnwpL6auOO40-gFMPvkPv23OtMnj2W3A==/fileview/DFD11F62E911327CB1F160F6T0000000000100000001", "errorCode": "0", "id": "DFD11F62E911327CB1F160F6T0000000000100000001", "refreshToken": "Yc_b_dE8V03eDTCmcmC1gi_y3LVJTPiZOSQDhuS_VWim9E_FRpLQGtEhgxCNbKTG", "role": "manager", "type": "applink" }