latestOpenAPI 3.0.02026-07-135965404.0 KB

a1bd874b5960

Shares

Creates a share

Creates a new share object for the given path in your account. We support three types of shares:

  • A shared folder allows you to let outside parties access a folder in your account (including any files and nested subfolders) using just a link. Shared folders can be restricted; e.g. with an expiration date, password, download-only, etc. Shared folders are 'live'; if someone makes a change to a file in your shared folder, it will be immediately reflected in your account, and vice-versa.
  • A file send lets you send one or more files via an easy download link. File sends are different than shared folders because file sends are 'point in time' -- the recipient will get the files as you sent them. If you later make a change to the source file, it will not be updated for the recipient.
  • A receive folder lets you receive files into your account. You can either send users a link, or optionally embed a customized form on your website.

How to send files from your computer using the API:

In order to use the API to send files which are not already stored in your account, you'll need to follow a three-step process:

  1. Use the POST /shares endpoint to set up your send, including password, recipients, expiration, etc. You must include upload among the permissions in the accessMode and set the sendingLocalFiles parameter to true. The response that is returned will include a "meta" attribute, which contains an accessToken attribute. This new access token is valid only for the send.
  2. Use the POST /resources/upload endpoint to upload your files to the send you've created. The "/" path represents the root of the share, not your home directory. You must send the access token that you received from the first step in the ev-access-token header
  3. Use the POST /shares/complete-send/{id} endpoint to indicate that you have finished uploading files to your send. This will trigger the system to remove the upload permission from the share and send any invitation emails you set up in the first step of the process. You must send YOUR access token in the ev-access-token header, not the temporary access token

Setting the Share Permissions

Only 5 different combinations of permissions are valid for the accessMode object:

  • Upload Only: This allows share visitors to upload to a share but do nothing else to the contained files. To use this mode, set upload to true and all other permissions to false
  • Download Only: This allows share visitors to download files from a share but do nothing else to the contained files. To use this mode, set download to true and all other permissions to false
  • Upload and Download: This allows share visitors to upload new files to the share or download files within the share, but not make any other changes to the share contents. To use this mode, set upload and download to true and set both modify and delete to false
  • All but Delete: This allows share visitors to make any changes to the contents of a share except deleting files. To use this mode, set upload, download, and modify to true and set delete to false
  • Full Access: This allows share visitors to make any changes to the contents of a share. To use this mode, set all 4 permissions upload, download, modify, and delete to true

Any other combination of permissions provided as the accessMode will be rejected as a bad request.

Notes:

Authenticated user requires share permission.

post/shares

Headers

ev-api-keystring required

API Key required to make the API call.

ev-access-tokenstring required

Access token required to make the API call.

Request body

type'shared_folder' | 'receive' | 'send' required

The type of share to create. See above for a description of each.

namestring required

A name for the share. This will be visible on the page that recipients visit.

resourcesstring[]

Array of resources for this share. See details on how to specify resources above.

shared_folder and receive shares must have only one resource, which is a directory that does not have a current share attached.

send shares may have multiple resource parameters. You can also leave this parameter null if you are planning to upload files to the send. If you are planning to upload files to the send that are not yet in your account, you will also need to call the POST /shares/complete-send/{id} endpoint to finish the send operation.

embedboolean

Whether this share can be embedded within a web page.

expirationstring date-time

Expiration date for the share. If someone attempts to use the share after this date, they will receive an error that the share is not available.

hasNotificationboolean

Whether delivery receipts should be sent.

isPublicboolean

Whether someone can visit the share without following a personalized recipient link.

messageBodystring

The message to be included in email invitations for your recipients. Ignored if you have not also provided recipients and messageSubject

notificationEmailsstring[]

Emails that will receive delivery receipts for this share. hasNotification must be true for delivery receipts will be sent.

passwordstring

Set a password for recipients to access the share. All recipients will use the same password.

requireEmailboolean

True if recipients must provide their email to view the share.

messageSubjectstring

Subject to use on emails inviting recipients to the share. Ignored if you have not also provided recipients and a messageBody

fileDropCreateFoldersboolean

Only used for receive shares. If true, uploads will be automatically placed into sub-folders of the folder, named after the chosen field on your form.

sendingLocalFilesboolean

Use this only for send shares. Flag to indicate that you are going to upload additional files from your computer to the share. If this is true, you will also need to use the POST /shares/complete-send/{id} call to finish setting up your share after the files are uploaded.

Example request

{
  "type": "shared_folder",
  "name": "Shared Folder",
  "resources": [
    "/testfolder"
  ],
  "expiration": "2017-09-25T14:12:10Z",
  "isPublic": true,
  "notificationEmails": [
    "notify@example.com",
    "notify2@example.com"
  ],
  "messageSubject": "Invitation to a shared folder"
}

Response

Successful operation

ShareResponse required— unresolved $ref