developer documentation r21358

Media callback

When you are using any of the APIs there are situations where data could be modified on our servers. These changes take a short time to appear on all our servers.

A great example of this is whenever you upload a new file, it could take a few minutes before the file is ready for consumption. The traditional way to find out if a file is ready is through polling. A metaphor for this would be kids on the backseat of your car asking "are we there yet?" every 5 minutes.

Using the callback, we will tell you when we're there! This is a much more effective way of communicating as the information only gets sent once. Don't call us, we call you!

Triggering events

There are currently 3 events that will trigger a callback:

The payload

We will send over all the information about the file in an XML format, very similar to what is returned from the "media.getFileInfo" API.

POST /yourcallback.py HTTP/1.1 Host: example.org Content-type: application/xml <?xml version="1.0" encoding="UTF-8"?> <result> <id>556114</id> <status>3</status> <contenttype>image/jpeg</contenttype> <filetype>1</filetype> <filename>Yankees-Should-Definitely-Sign-Guy.jpg</filename> <injector>httpupload</injector> <hits>0</hits> <message></message> <date>2009-01-31 22:11:18</date> <title>Test 7 : single + empty</title> <tags></tags> <extension>jpg</extension> <sender></sender> <uid>1543</uid> <filesize>30191</filesize> <ofilesize>113111</ofilesize> <upload>2009-01-31 22:11:18</upload> <privacy>1</privacy> <moderationstatus>0</moderationstatus> <width>0</width> <height>0</height> <length>0.00</length> <conversiontime>3.808</conversiontime> <converttime>2009-02-04 12:17:41</converttime> <offensive>0</offensive> <autoblog>0</autoblog> <rating>0</rating> <votecount>0</votecount> <commentcount>0</commentcount> <approvedcomments>0</approvedcomments> <notdeniedcomments>0</notdeniedcomments> <parentid>0</parentid> <user_name>evert</user_name> <user_country>CA</user_country> <user_city>Toronto</user_city> <user_state></user_state> <user_nickname>Evert</user_nickname> <user_firstname>エヴァート</user_firstname> <user_lastname>ぽつ</user_lastname>i <url></url> <vhost>16</vhost> <rotation>0</rotation> <language></language> <channel>340</channel> <channel_shortname>mychannel</channel_shortname> <channel_name>Testing</channel_name> <geo_latitude/> <geo_longitude/> <publicUrl>http://fmdevs3.filemobile.com/storage/556114</publicUrl> <thumbUrl>http://fmdev.s3.amazonaws.com/storage/556114</thumbUrl> <moderationdeniedid>0</moderationdeniedid> </result>

As you can see we don't specifically mention what has been changed. We just give you the latest version of all the information.

How it works

We only send out this information every 5 minutes. If there are multiple changes within this timespan, we will only give the the very latest information and we don't trigger the request for every individual change.

We might change this 5 minute timeframe to be either higher or lower depending on the usage patterns we're seeing. There is also no guarantee the callback will always be triggered. We'll make sure it works 99% of the time.

The receiving end

The payload will be supplied as an HTTP POST request with an XML body. You should be prepared to accept this request. We require HTTP/1.1 with pipelining support for speed.

<< 8.1 Videomixer API 8.3 Dynamic Image Resizer >>