HTTP Upload Token¶
Using a HTTP Upload Token, you can upload content or allow a client/customer to upload content to a StreamOne Account. The content can be uploaded as a new Item, or optionally as a file within an existing Item. It is also possible to upload Item thumbnails using an Upload Token.
Step 1: Creating the token¶
The method for creating an Upload Token depends on the API version you are using. Using the API you can set the Account ID, User ID, File Type and the token expiration time.
Please check the appropriate API documentation for creating the Upload Token:
- For API version 2, use the items/createuploadtoken action
- For API version 3, use the uploadtoken/create action
When creating an upload token in APIv3, the item ID and file ID of the resulting item and file are returned in the API output. If the upload token retrieved via APIv2 is at most 16 characters in length, it represents either the ID of the item being created if a new item is to be created, or the ID of the file being created if a file is uploaded into an existing item.
Step 2: Uploading content¶
Uploading content can be performed through a HTTP POST to the uploadUrl that is returned by the API in Step 1 (don’t forget enctype="multipart/form-data"). Required parameters are as follows:
These fields should/can be in the form:
- uploadtoken = The upload token (case-sensitive) as received from the API, required
- returnurl = The URL where the user will be redirected after the upload. ?error=(StreamOne error code) is appended when something went wrong, required
- uploadfile = (type=file) The file to upload, required
- title = (when creating a new item) Title of the item, optional
- author = (when creating a new item) Author of the item, optional
- description = (when creating a new item) Description of the item, optional
- archived = By default the newly uploaded file will be marked as archived. Set this field to 0 to not mark it as such, optional
- replaceitem = (when adding a file to an existing item) If given, the ID of the item to replace the files of. This will archive all current files of that item after transcoding of the new file completes, optional
- categories = (when creating a new item) Categories to add the item to. Can be either one category ID or comma separated list of category ID’s, optional
- itemarchived = (when creating a new item) If set to 1, this will immediately archive the newly created item, optional
- keywords = (when creating a new item) Comma separated list of keywords to add to the new item, optional
- transcodeprofilegroup = (when creating a new item or replacing an item) ID of a transcode profile group to use to transcode the file, optional. If not given, it will use the default transcode profile groups of the account
An upload token kan be used only once. If an upload fails, you will need to create a new Upload Token. Metadata will be added later.