Skip to main content
NICE CXone Expert

We will be closed on Monday, May 27th in observance of Memorial Day

Expert Success Center

files/{fileid}/{filename} (PUT)


Replace an existing attachment with a new version

  • REST Method: PUT
  • Method Access: public

Uri Parameters

Name Type Description
filename string Double uri-encoded file name. Should be prefixed with "=" if it does not have an extension.
pageid string either an integer page ID, "home", or "=" followed by a double uri-encoded page title

Query Parameters

Name Type Description
redirects int? If zero, do not follow page redirects.
description string? file attachment description
authenticate bool? Force authentication for request (default: false)

Return Codes

Name Value Description
OK 200 The request completed successfully
Bad Request 400 Invalid input parameter or request body
Forbidden 403 Update access to the page is required
Not Found 404 Requested page could not be found

Message Format


<file id="{id}" revision="{int}" href="{uri}">
  <contents type="{MIME}" size="{int}" href="{uri}"/>
  <user.createdby id="{int}" href="{uri}">
  <revisions count="{int}" totalcount="{int}" href="{uri}"/>
  <page.parent id="{int}" href="{uri}">

Implementation Notes

This feature works in exactly same way PUT:/files/{fileid} does. A doubly encoded filename can be appended to the end of the path to designate the desired filename on the Expert filesystem.

Curl Sample: Update a File

The following command updates a file (file ID = 1) with the file "foo". The stored file name will be "bar".

Sample Code

curl -u username:password -H "Content-Type: xxx" -T foo -i

Implementation notes 

curl flags

Basic HTTP authentication. Sends a username and password to server so it can verify whether a user is of privilege to perform specific operation.
Sends a file using the PUT command.
Adds a header or modifies an existing one. This is used to modify the "Content-Type" HTTP request header. Remember to set it to the appropriate MIME according to the file uploaded (for example image/jpg for a jpeg image).
Includes the HTTP response header in the output. Useful for debugging.


It's important to specify a MIME type in the "Content-Type" header for the server to process the file correctly.


We at Expert love playing pranks on each other. So we are going to update an existing image to one that which will most likely annoy a user. The following demonstrates how to change a file (file ID = 71) to an image, "troll.jpg". The image will be named "trollface.jpg" in the Mindtouch directory.

Sample Code

curl -u admin:password -H "Content-Type: image/jpg" -T trollface.jpg -i

HTTP Response Headers

HTTP/1.1 200 OK
Date: Thu, 21 Jan 2010 22:49:11 GMT
Server: Dream-HTTPAPI/ Microsoft-HTTPAPI/2.0
Content-Length: 2022
Content-Type: application/xml; charset=utf-8
X-Data-Stats: request-time-ms=1919; mysql-queries=21; mysql-time-ms=143;
X-Deki-Site: id="default"
Via: 1.1 dekiwiki

HTTP Response Body

Content-Type: application/xml

<?xml version="1.0"?>
<file id="71" revision="5" href="">
  <contents type="image/jpg" size="88820" width="469" height="428" href=""/>
  <contents.preview rel="thumb" type="image/jpeg" maxwidth="160" maxheight="160" href=""/>
  <contents.preview rel="webview" type="image/jpeg" maxwidth="550" maxheight="550" href=""/>
  <user.createdby id="1" href="">
  <revisions count="5" totalcount="5" href=""/>
  <page.parent id="567" href="">
  <properties count="1" href=" deki/files/71/properties">
    <property name="iscopyright" href="" etag="106.r2_ts2010-01-21T19:54:52Z">
      <contents type="text/plain" size="3" href="">yes</contents>
      <user.modified id="1" href="">


  • Was this article helpful?