Community articleReplacing a Photo or Video
Added by IBM contributorIBM on March 31, 2014
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Provides details on how to replace a photo or video in a Media Gallery

Replace a photo or video in the Media Gallery by performing a multipart/form-data POST. When a replace is performed, then the preview associated with the photo or video will be regenerated if the content is a photo. On the other hand, if the content is a video, then you should ensure that no preview will exist after the replace until the user adds a thumbnail preview to the video.
 

Discoverability
You can derive the URL from the video document entry. Use the web address specified as the "href" attribute of the http://www.ibm.com/xmlns/prod/sn/cmis/multipart-form/object"> element.

Input
Method URI Description
POST /files/{authType}/cmis/repository/{repositoryId}/mobject/{objectId} URL to use to create a photo or video.
You can derive the URL from the video document entry. Use the web address specified as the "href" attribute of the http://www.ibm.com/xmlns/prod/sn/cmis/multipart-form/object"> element.
Use the table below that represents the expected fields:
Name Type Optional Description
cmis:contentStream
string Yes This is the photo or video data.
cmis:name
string Yes String. Use the name that you would like the file named
cmis:contentStreamFileName
string Yes String. Use the name that you would like the file named
cmis:changeToken
string Yes String. Use the timestamp of the time of change. (Ex: 2012-08-07T20:11:34.990Z)
cmis:objectId
string Yes String. Use the original file's cmis object id.
cmis:objectTypeId
string Yes String. Use the id of the cmis object type you have associated with a video if uploading a video or photo if uploading a photo. See more details on CMIS object types by going to Retrieving CMIS Object Type properties.
snx:deleteRenditions
string Yes String. Use the value "*" to ensure that old preview images are removed.
snx:tags
string Yes String. Use a space separated list of tags associated with the file. Tags may be lost on replace without including the tags.
Name Type Optional Description
repositoryId
string No ID of the repository containing the media content
objectId
string No Object ID. By default the Media Gallery provides and uses a "Social Photo" object type with a CMIS id of "ada30772-31fe-44bf-b8b4-dd7e4f072cd6" and a "Social Video" object type with a CMIS id of "ada30772-31fe-44bf-b8b4-dd7e4f072ad6".
authType
enumerated No Authentication type
Authorized values:
  • basic
  • form
  • oauth
Name Type Optional Description
filter
string Yes String. Use the value "{objectId}:modified={numericalDateRepresentation}:uid={userId}" where {objectId} is the id of the photo or video object, {numericalDateRepresentation} is the epoch time value (Ex. 1345051971834), and {userId} is the id of the user adding the photo or video.
String. Use value "PUT".
String. See Retrieving Nonce and User id for how to retrieve the nonce value.
nonce
string Yes String. See Retrieving Nonce and User id for how to retrieve the nonce value.
opId
string Yes String. Use the value "replace,{objectId},{numericalDateRepresentation}". Replace {objectId} with id of the photo or video object. Replace {numericalDateRepresentation} with a number that represents the current timestamp.
setNotification
string Yes String. Use the value "true".
versioningState
string Yes String. Use the value "none". The Media Gallery does not support having versions of files.
Name Type Optional Description
If-Match
string Yes String. Use the value "{objectId}:modified={numericalDateRepresentation}:uid={userId}" where {objectId} is the id of the photo or video object, {numericalDateRepresentation} is the epoch time value (Ex. 1345051971834), and {userId} is the id of the user adding the photo or video.
X-Method-Override
string Yes String. Use value "PUT".
X-Update-Nonce
string Yes String. See Retrieving Nonce and User id for how to retrieve the nonce value.