• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar
VdoCipher: Secure Video Hosting for Business

VdoCipher

☰
  • Features
  • Pricing
  • Testimonials
  • About
  • Contact Us
Login
Sign Up

Video upload from website or server to VdoCipher API

February 2, 2016 /

[Update 24/05/2018] This blog has been updated for API Version v3. A previous version of this blog used API v2. If you are using API v2 you can contact us at support@vdocipher.com. You can use VdoCipher API v3 to build a workflow around your video website as suggested in this blog. The complete API v3 reference, with sample codes for different backend languages, can be accessed from the API Sample Docs.

We use Amazon AWS storage to store original user videos securely in AWS S3. With an intent to automate their online business, many of our customers wish to allow their users to upload videos directly from their website. To enable this, we have an API call that returns an authenticated policy document which is used video upload into a S3 bucket allotted to your account.

Step 1 (Obtain authorized access):

Create authorized video upload request with your API secret key.

Request
Endpoint: https://dev.vdocipher.com/api/videos?title=videotitile
Method: PUT
HEADER: Authorization: Apisecret a1b2c3e4e5d6 
Response
Content-Type: application/json
"clientPayLoad":{
 "policy":
 "key":
 "x-amz-signature": ,
 "x-amz-algorithm": ,
 "x-amz-date": ,
 "x-amz-credential": ,
 "policy":  ,
 "upload_link_secure": ,
}
"video_id":

The API call has returned a set of parameters that must go with the video upload call to the AWS S3 endpoint. We shall refer to this JSON object returned above as uploadData.

The policy document is valid only for the next 1 hour. It is recommended to make the video upload immediately after creating the authorized access. There is also a soft restriction on the number of upload calls every hour, so it is advised to create it only after the user has chosen to upload the video. It should not be made every time somebody loads their dashboard or mobile app.

This call must be made from a secure environment such as your server. This should not be called from a mobile device or the browser to protect your API key. The uploadData should then be passed to user’s device (mobile or browser) to do the file upload.

Step 2 (Video upload via S3 API):

Upload the file to amazon s3 directly. This upload can be made using server code or using an HTML5 form. You can use any third party upload library to make the upload script. The famous ones already have tutorials on setting it up with S3 upload.

application Request
Endpoint: https://{bucket}.s3.amazonaws.com/
Method: POST
Form-Data:
 'x-amz-credential': uploadData['x-amz-credential'],
 'x-amz-algorithm': uploadData['x-amz-algorithm'],
 'x-amz-date' : uploadData['x-amz-date'],
 'x-amz-signature': uploadData['x-amz-signature'],
 'key' : uploadData['key'],
 'policy' : uploadData['policy'],
 'success_action_status' : 201,
 'success_action_redirect' : 'http://example.com'
 'file': <file content>
  • upload_link_secure string – The vdocipher storage location on S3 that has been allocated for this file
  • x-amz-credential string – These must be accompanied in the upload request.
  • x-amz-algorithm string
  • x-amz-date string
  • x-amz-signature string – A signature value that authorizes the form and proves that only vdocipher could have created it.
  • key string – A name for the S3 object that will store the uploaded file’s data
  • policy string – authorization string
  • success_action_status integer – The status code returned upon successful upload if success_action_redirect is not specified.
  • success_action_redirect string – Specifies if to redirect to a URL after a successful post instead of issuing a 201. Set this to an empty string if you do not want to redirect to a specific page.

If everything goes right, the response from the above request should be:

Response
<?xml version="1.0" encoding="UTF-8"?>
<PostResponse>
  <Location>https://{{bucket}}.s3.amazonaws.com/orig%2F5555555555555</Location>
  <Bucket>vdo-ap-southeast</Bucket><Key>orig/5555555555555</Key>
  <ETag>xxxxxxxxxxxxxxxxxx</ETag>
</PostResponse>

You can ignore the content of this response. Now, the video status should be shown as Queued or Processing in the API or on your dashboard. The video will get processed after some time. You can poll the API or configure the web hooks(coming soon) to know the time when video is ready. You should only load the video player if the video is ready.

 

Some sample code for the above operations:

  • PHP
  • C#

The complete VdoCipher API reference for Server APIs, player embedding and player customizations can be accessed through the API page. You can use VdoCipher API v3 to build a workflow around your video website as suggested in this blog.

Supercharge Your Business with Videos

At VdoCipher we maintain the strongest content protection for videos. We also work extremely hard to deliver the best viewer experience. We'd love to hear from you, and help boost your video streaming business.

Free 30-day trial →

Filed Under: APIs and Sample Codes, asp, PHP, Technology, Using VdoCipher Tagged With: api, upload api, upload video api, v2

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar



Secure Your Videos

Blog Categories

  • DRM 
  • APIs and Sample Codes
  • WordPress
  • E-learning
  • Media
  • Video Tech
  • Portuguese
  • Spanish
  • Arabic

Popular Posts

  • Google Widevine DRM 
  • WordPress video plugin: Add Secure Videos to your WP site
  • Understanding Video Quality – Pixels (p), Bitrate (kbps), Aspect Ratios
  • Add text to video with dynamic watermarking
  • Encrypted Video Streaming: VdoCipher & Others
  • Video Hosting For Online Courses
  • Video Quality: What is Video Bitrate, Pixel & Aspect Ratios 
  • Online Video Player
  • Apple Fairplay DRM
  • Study Apps For Students
  • SVOD VS TVOD VS AVOD
  • DRM Security
  • Exoplayer Tutorial
  • Video Platform Comparison

Recent Top Post

  • Enterprise Video Platform
  • Cloud Video Platform
  • Shaka Player
  • Install FFMPEG on Windows
  • Video Aspect Ratio
  • Video Streaming Protocols
  • Adaptive Bitrate Streaming
  • Elearning Statistics 2021
  • DRM Solution
  • Video Bitrate
  • History Of Youtube
Recent Blogs
  • Guide to Video in WordPress with Embed, Gallery & Player Plugin etc
  • Best WordPress Video Hosting Plugin & issues with Self Hosting
  • Custom variables as watermark on WordPress videos
  • History of YouTube – How it All Began & Its Rise
  • Best Video Streaming Hosting Service Providers in 2023
  • Секреты видеохостинга: Как монетизировать ваши видео
  • Топ-7 платформ онлайн-видеохостинга для онлайн-курсов
  • Sharing Private Video Securely with Encrypted Upload and Streaming
Popular Blogs
  • How many use easy video download piracy tools ?
  • Quickest Way to Start Your Video Selling Site
  • WordPress course plugin to make course website – Sensei tutorial
  • VdoCipher package Workflow and demo – Secure video streaming
Navigation
  • Home
  • Glossary
  • Features
  • About Us
  • Pricing
  • FAQs
  • Terms
  • Privacy Policy
  • Contact US
Industry
  • Education and Training
  • Media and Entertainment
  • DRM and Antipiracy
  • APIs for Developers
  • Video Hosting and Marketing
Follow Us
We are Amazon AWS Technology Partner for Secure Video Hosting for Business
We use Akamai CDN for Secure Video Streaming for Business

© 2023 VdoCipher Media Solutions Pvt. Ltd.