PandaStream API ColdFusion Wrapper

On November 11, 2011, in ColdFusion, Railo, by Anuj Gakhar

In my recent project, one of my tasks is to encode videos in multiple formats. And we decided to use PandaStream for the job. PandaStream is a flexible and highly scalable cloud video encoding API. Here is en entire list of their supported file formats.

They seem to have a fairly decent REST API, which obviously means that in order to consume it, I had to write a API wrapper. So, I did 🙂 The code is available on github.

Here is some sample usage on how you can use the API client :-

To initialise the CFC, you pass in the required parameters :-

ACCESS_KEY = "access_key";
SECRET_KEY = "secret_key";
CLOUD_ID = "cloud_id";

panda = createObject("com.anujgakhar.PandaStreamAPI").init(
cloud_id="#CLOUD_ID#",
access_key="#ACCESS_KEY#",
secret_key="#SECRET_KEY#"
);

A Sample GET Request

panda.get('/videos.json');	
or
panda.get('/videos/:id.json')

A Sample DELETE Request

panda.delete('/videos/:id.json');

A Sample PUT Request

params = {};
params.name = "updated_from_api";
panda.put('/clouds/#CLOUD_ID#.json', params);

A Sample POST Request

params = {};
params.source_url = "http://example.com/path/to/video.mp4";
newVideo = panda.post('/videos.json', params);

Enjoy!

Tagged with:  

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 446 other subscribers

© 2011 Anuj Gakhar
%d bloggers like this: