API Reference

Media.updateFile

Changes the properties of a media item.


Syntax

bool media.updateFile ( int/array id, array newProperties, mixed options = array() )

Arguments

NameTypeRequiredDefault valueDescription
idint/arrayRequirednoneID or array of IDs of the media item you want to update.
newPropertiesarrayRequirednoneAn associated array with new and or updated values to be applied to the media item.
optionsmixedOptionalarray()

New Properties

The options array may contain the following parameters.

NameTypeDescriptionPossible Values
uidINTThe new user ID for the media item.INT
titleSTRINGThe new title for the media item.N/A
messageSTRINGThe new message for the media item.N/A
hiddenSTRINGThe hidden status of the media item.HIDDEN or SHOWN
tagsSTRINGUpdated tags for the media item. This will overwrite the existing tags with the newly specified tags.N/A
moderationstatusINTThe new moderation status of the media item.

Media Moderation Notifications:
Media Moderation notification emails can be sent when media is approved or denied. To send these emails, set the `Approved Moderation Email` and `Denied Moderation Email` templates in the channeldetail page of the channel that the media are in.
0,1,2,3,-1 (Check the word possibilities unmoderated, accepted, denied, deleted, notdenied, moderated, all)
channelINTThe channel ID of the updated channel the media item will be a member of.INT
parentidINTThe new parent ID for the media item. This can be used to assign a media item as a comment along with updating the media context as well or switching a comment from one parent media item to another.INT
metadataARRAYThe new or updated additional values for the media item.'metadata': {'user': {'keyvalue': 'test update'}}
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 2Only one record can be the primary external id for each media.

    NOTE 3The 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.
NOTEYou 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.newspark.ca/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