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:
| Preference | Description |
|---|---|
| Request | |
| Upload URL | URL to the upload API, must include scheme (http:// or https://) |
| Method | POST or PUT, depending on the Upload API |
| Content-Type | Currently, multipart/form-data is supported |
| Form Field | Name of the form field which will contain the file, for multipart/form-data requests. |
| Header | Key-Value definition of request header. See "Request Placeholders" for options. Example: {"Authorization":"YOUR_API_KEY"} |
| Body | Key-Value definition of request body. See "Request Placeholders" for options. Example: { "filename": "%filename%", "secure_url": true} |
| Delete Body | Key-Value definition of delete request body. See "Request Placeholders" for options. Example: {"filename": "%raw.url.path%"} |
| Preference | Description |
|---|---|
| Response | |
| URL to file | URL to the uploaded file. See "Response Placeholders" for options. |
| Content Type | Content type of response, can be JSON or Plain Text. When using Plain Text, use %raw% for the URL to file. |
| Delete URL | URL 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:
| Preference | Description |
|---|---|
%filename% | Original name of the uploaded file |
Response Placeholders
The following placeholders can be used for the URL to file:
| Preference | Description |
|---|---|
%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.pngPlaceholder 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.

