The Upload API is the best way to programmatically get new videos and files into your Wistia account.
If you are looking to have site visitors upload content (something like user generated content) you should also check out Upload Widgets.
Uploading to Wistia
To upload a file from your computer, supply the required parameters and POST your media file to https://upload.wistia.com/ as multipart-form encoded data.
Uploaded media will be visible immediately in your account, but may require processing (as is the case for uploads in general).
Importing Web/FTP Content to Wistia
To import a file from a web or FTP server, supply the required parameters as a standard form-url encoded POST to https://upload.wistia.com/.
Imported media will always require some processing time, which varies depending on the file size and connection speed.
There's a Gem For That
To make using the Upload API even easier, we created a Ruby gem for it, just for you! Even if you're not a Ruby developer, you can use this as a command line tool for uploading to Wistia.
Authentication
- All upload requests must use SSL (https://, not http://).
- The required api_password parameter will be used for authentication.
The Request
POST https://upload.wistia.com
All parameters (with the exception of file) may be encoded into the request body or included as part of the query string.
The file parameter must be multipart-form encoded into the request body.
| Parameter | Description |
|---|---|
| api_password | Required. A 40 character hex string. This parameter can be found on the API page in your Account Dashboard. |
| file | Required unless `url` is specified. The media file, multipart-form encoded into the request body. |
| url | Required unless `file` is specified. The web or FTP location of the media file to import. |
| project_id | The hashed id of the project to upload media into. If omitted, a new project will be created and uploaded to. The naming convention used for such projects is Uploads_YYYY-MM-DD. |
| name | A display name to use for the media in Wistia. If omitted, the filename will be used instead. |
| contact_id | A Wistia contact id, an integer value. If omitted, it will default to the contact_id of the account's owner. |
Response Format
For successful uploads, the Upload API will respond with an HTTP-200 and the body will contain a JSON object
- HTTP 200 [application/json] Success. A JSON object with media details.
- HTTP 400 [application/json] Error. A JSON object detailing errors.
- HTTP 401 [text/html] Authorization error. Check your api_password.
Example Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
This data structure may change in future releases.
Examples
Uploading a media file with cURL:
$ curl -i -F api_password=<YOUR_API_PASSWORD> -F file=@<LOCAL_FILE_PATH> https://upload.wistia.com/
Importing a media file with cURL:
$ curl -i -d "api_password=<YOUR_API_PASSWORD>&url=<REMOTE_FILE_PATH>" https://upload.wistia.com/
Ruby Code
All media uploaded via https://upload.wistia.com must be transferred as multipart-form encoded data inside the body of an HTTP-POST. This can be achieved in Ruby quite simply using the 'multipart-post' gem.
Installation:
$ gem install multipart-post
Example Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
Upload Via FTP
Do you have an FTP client? One that is awesome? I use Transmit.
We've been quietly testing upload via FTP, for folks who want to move a large library over to Wistia. The bugs have not been worked out, and some of our requirements means not all FTP clients can support it, but for certain use cases it may help.
Here's the workflow:
- Load up transmit, and enter the following settings:
- Server: ftp.wistia.com
- User Name: wistia
- Password: your account's API key
- and make sure to select FTP with TLS/SSL from the security options.
- Your projects list will appear.
- When uploading, upload into the Project's folder, not it's
_assetsdir