API Reference

Media.updateFile

Changes the properties of a media item.


Syntax

bool media.updateFile ( int id, array newProperties, bool mergeMeta = 0 )

Arguments

NameTypeRequiredDefault valueDescription
idintRequirednoneID of the media item you want to update.
newPropertiesarrayRequirednoneAn associated array with new and or updated values to be applied to the media item.
mergeMetaboolOptional0If set to 1, any user meta in newProperties will be merged with existing, rather then replaceing exisiting metadata.
languageSTRINGThe 2-letter ISO code that will be used to updated the media's language value.STRING
dateYYYY-MM-DD HH:MM:SSThe new date that will be stored for reference to the creation date of the media item.YYYY-MM-DD HH:MM:SS
startdateYYYY-MM-DD HH:MM:SSThe starting date that will be stored for reference for the availability of the media item.YYYY-MM-DD HH:MM:SS
enddateYYYY-MM-DD HH:MM:SSThe ending date that will be stored for reference for the end of availability of the media item.YYYY-MM-DD HH:MM:SS
offensiveINTThe number of times that this media has been reported as offensive.INT
geo_latitudeFLOATThe geographic latitude of the file in degrees latitude, specified as a float up to 14 decimals.50.00000000000001
geo_longitudeFLOATThe geographic longitude of the file in degrees latitude, specified as a float up to 14 decimals.-70.00000000000001
externalidsARRAYThis is an array of the third party IDs for the file; it is available only if the file is hosted by one of our partners, such as Twitter, Instagram, Youtube, Brightcove, Widen and Ooyala.

The external id provider values are stored as an integer, and are below:
  • 0 - other: any provider other than the 7 mentioned below. You can store any reference using this provider.
    i.e. 'http://www.arbitrarysite.com/image=123'
  • 1 - Brightcove
  • 2 - Youtube
  • 3 - Instagram
  • 4 - Twitter
  • 5 - Widen
  • 6 - Apple
  • 7 - Ooyala


*** NOTE 1 ***
Each recordset in the array is an array itself that contains the following:
  • external_id (string)
  • external_id_provider (integer)
  • created (the date the externalid record created/updated)
  • vhost
  • primary_external_id (Integer. States whether this is the media's primary external id: possible values: 1 or 0.)
  • .

    *** NOTE 2 *** Only one record can be the primary external id for each media.

    *** NOTE 3 *** The record that is noted as the primary external id is stored in the externalid with the reference to the external id provider stated before the external id.
Format

array (
   < ext. id provider 1 > => '< external id a >',
   < ext. id provider 2 > => '< external id b >'
   )


Example 1:
Updates media's external ids for Brightcove and Instagram.

array(
   1 => '545433_57632'
   3 => '545433_57633'
   )


Example 2:
Sets the `primary external id` the media yo 2.
*** NOTE *** You can not set the `primary external id` to an externali id that does not exist for the media.

array(
   1 => '545433_57632'
   3 => '545433_57633'
    )

Response

The response returned on success and failure of media update.

NameTypeDescriptionPossible Values
resultbooleanThe returned result of the request to update the media item.true/false
statusbooleanThe status of the request as a whole. Unrelated to the success of updating the media item but rather was the request executed in full.true/false

Sample Response

Sample REST Response
http://api.filemobile.com/services/rest/media/updateFile?id=[MEDIA_ID]&newProperties[message]=[NEW_MEDIA_MESSAGE]&newProperties[metadata][user][key]=ADDITIONAL_USER_VALUE&APIKEY=[APIKEY]
<?xml version="1.0" encoding="UTF-8"?>
<result>1</result>
Sample JSON Response
{
    "status": true,
    "result": 1
}

Code examples

0 comments

Be the first to comment on updateFile.

Add a Comment

  • captcha