Retrieve Files with Web Services

Web services such as getFiles and getFileInfo will return two elements: publicUrl and thumbUrl.

publicUrl will first log a view (hit) in Media Factory and then redirect to the actual file in storage which is thumbUrl.

thumbUrl bypasses the hit-logging and simply returns the image from storage. This is so-called for its typical usage for displaying thumbnails.

Appended to the storage domain will be the /storage directory and /mediaID:

For example, rstorage would contain:

Make sure you append the appropriate transcoder profile to the url. This is for example /12 for an 84x84 thumbnail or /2405 for an MPEG4 file.

Both of these variables can change depending on your configuration. For example, if your application is secure, both URLs would be HTTPS or if you are using a CDN, publicUrl would redirect to your storage URL.

The storage URL for CDN is configured in Settings > Project Settings in Media Factory.

A PHP example:

$path = '';
$arguments = array(
'APIKEY' => 'your-api-key',
'method' => 'media.getFileInfo',
'id' => 5413023,

$url = $path .'?' . http_build_query($arguments,null,'&');
$data = file_get_contents($url);
$data = unserialize($data);

echo $data['result']['publicUrl']."/15";

This will print:

which when retrieved will log a hit and redirect to:


Configure Storage and CDN


Be the first to comment on Retrieve Files with Web Services.

Add a Comment

  • captcha