Skip to content

Custom API

Dropshare 5.58 and newer

Dropshare supports uploading to any custom API that accepts file uploads and responds with a URL to the uploaded file.

To set up an upload connection using a Custom API, select Custom API under "Custom Services" when creating a new connection in the Connection preferences.

Set up the credentials as follows:

PreferenceDescription
Request
Upload URLURL to the upload API, must include scheme (http:// or https://)
MethodPOST or PUT, depending on the Upload API
Content-TypeCurrently, multipart/form-data is supported
Form FieldName of the form field which will contain the file, for multipart/form-data requests.
HeaderKey-Value definition of request header. See "Request Placeholders" for options.
Example: {"Authorization":"YOUR_API_KEY"}
BodyKey-Value definition of request body. See "Request Placeholders" for options.
Example: { "filename": "%filename%", "secure_url": true}
Delete BodyKey-Value definition of delete request body. See "Request Placeholders" for options.
Example:{"filename": "%raw.url.path%"}
PreferenceDescription
Response
URL to fileURL to the uploaded file. See "Response Placeholders" for options.
Content TypeContent type of response, can be JSON or Plain Text. When using Plain Text, use %raw% for the URL to file.
Delete URLURL to call when the file should be deleted. Can be an API URL (select Method in "Delete Method"), or a website to be opened (select "Browser"). See "Response Placeholders" for options.

Request Placeholders

The following placeholders can be used for the request URL, header or request body fields:

PreferenceDescription
%filename%Original name of the uploaded file

Response Placeholders

The following placeholders can be used for the URL to file:

PreferenceDescription
%raw%Full plain text response from Upload API, e.g. if the API responds with just the URL to the uploaded file.
%raw.url.path%
(Only Delete Body)
If the plain text response is a URL (e.g. the direct URL to a file), this can be used to get the path of the uploaded file without the hostname. E.g.:
Plaintext response: http://upload.api/yourfile.png
Placeholder response: yourfile.png

When using JSON as content type for the response, all JSON object properties can be used as placeholders for the URL to file.

Example JSON 1

{
  "file": {
    "url": "http://server.com/uploads/file.png"
  }
}

Use then %file.url% as URL to file.

Example JSON 2

[
  {
    "url": "http://server.com/uploads/file.png"
  }
]

Use then %[0].url% as URL to file.

Example JSON 3

{
  "files": [
    "http://server.com/uploads/file.png"
  ]
}

Use then %files[0]% as URL to file.