Media Callback

When dealing with New Spark Platform, there are situations where data could be modified on our servers and and you wish to be notified immediately.

There are four events within the platform that will trigger a call-back:

  • When a user rates a file
  • When a file is moderated (denied or approved)
  • When a file finishes being transcoded
  • When the system receives a callback from Brightcove (externalid)

One of the most common uses of this call-back is moderation. If your site is cached, and a file is denied, it will not be removed until your cache clears. Using the callback, you can take the appropriate action to immediately remove media that has been denied.

Configure the Media Callback URL

Locate the wrench icon in the top right-hand corner of the nav. Select "Project Settings" and once on this page, scroll down to the bottom field named Media Callback URL. This is where you will need to place the callback URL.

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 method:

We only send out this information every 60 seconds. 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 60-second timeframe to be either higher or lower depending on the usage patterns we're seeing.

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/>
  <externalid/>
  <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.

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.

0 comments

Be the first to comment on Media Callback.

Add a Comment

  • captcha