Skip to main content
NICE CXone Expert
Expert Success Center

pages/{pageid}/files/{filename}/revisions (GET)

Overview

Retrieve file revision info

  • REST Method: GET
  • Method Access: public

Uri Parameters

Name Type Description
fileid int identifies a file by ID
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 path

Query Parameters

Name Type Description
authenticate bool? Force authentication for request (default: false)
redirects int? If zero, do not follow page redirects (only applies when {pageid} is present).
changefilter string? Only show revisions having a user-action listed in this comma delimited list. Valid actions are: CONTENT, NAME, LANGUAGE, META, DELETEFLAG, PARENT (default: filter with CONTENT)

Return Codes

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

Message Format

Output:

<files count="{int}">
    <file id="{int}" revision="{int}" href="{uri}">
        <filename>{text}</filename> 
        <description>{text}</description> 
        <contents type="{mimetype}" size="{int}" width="{int}" height="{int}" href="{uri}" /> 
        <contents.preview rel="thumb" type="{mimetype}" maxwidth="{int}" maxheight="{int}" href="{uri}" revision="{int}" /> 
        <contents.preview rel="webview" type="{mimetype}" maxwidth="{int}" maxheight="{int}" href="{uri}" revision="{int}" /> 
        <date.created>{date}</date.created> 
        <user.createdby id="{int}" href="{uri}">
            <nick>{text}</nick> 
            <username>{text}</username> 
            <email>{text}</email> 
       </user.createdby>
  </file>
  ...
</files> 

Implementation Notes

A single Expert site can store up to 5,000 attachments.

A new file revision is created whenever a file with the same name is uploaded to the same page.  Use GET:files/{fileid} with the revision parameter to retrieve the file from a specified revision.

The contents.preview element only exists if a file preview is available.  Preview generation requires the file to be an image and fall within a certain size.

C# Code Sample: Retrieve File Revision Info

The following code example retrieves revision information about the file with ID 456:

Sample Code

Plug p = Plug.New("http://help.mindtouch.us/@api/deki");
p.At("users", "authenticate").WithCredentials("admin", "password").Get();
p.At("pages", "home", "files", "=myfile%252ejpg", "revisions").Get();

Sample Response from executing Code

Sample response indicating that there are two file revisions:

<files count="2">
      <file id="456" revision="1" href="http://help.mindtouch.us/@api/deki/files/456/info?revision=1">
          <filename>myfile.jpg</filename> 
          <description/> 
          <contents type="image/pjpeg" size="53112" width="476" height="480" href="http://help.mindtouch.us/@api/deki/files/456?revision=1" /> 
          <contents.preview rel="thumb" type="image/pjpeg" maxwidth="160" maxheight="160" href="http://help.mindtouch.us/@api/deki/files/456?revision=1&size=thumb" revision="1" /> 
          <contents.preview rel="webview" type="image/pjpeg" maxwidth="550" maxheight="550" href="http://help.mindtouch.us/@api/deki/files/456?revision=1&size=webview" revision="1" /> 
          <date.created>2007-08-25T00:11:01Z</date.created> 
          <user.createdby id="1" href="http://help.mindtouch.us/@api/deki/users/1">
              <nick>Admin</nick> 
              <username>Admin</username> 
              <email>admin@mindtouch.com</email> 
          </user.createdby>
      </file>
      <file id="456" revision="2" href="http://help.mindtouch.us/@api/deki/files/456/info?revision=2">
          <filename>myfile.jpg</filename> 
          <description /> 
          <contents type="image/pjpeg" size="53112" width="476" height="480" href="http://help.mindtouch.us/@api/deki/files/456?revision=2" /> 
          <contents.preview rel="thumb" type="image/pjpeg" maxwidth="160" maxheight="160" href="http://help.mindtouch.us/@api/deki/files/456?revision=2&size=thumb" revision="2" /> 
          <contents.preview rel="webview" type="image/pjpeg" maxwidth="550" maxheight="550" href="http://help.mindtouch.us/@api/deki/files/456?revision=2&size=webview" revision="2" /> 
          <date.created>2007-08-27T19:59:24Z</date.created> 
          <user.createdby id="1" href="http://help.mindtouch.us/@api/deki/users/1">
              <nick>Admin</nick> 
              <username>Admin</username> 
              <email>admin@mindtouch.com</email> 
          </user.createdby>
      </file>
</files>

Implementation notes 

Add notes about requirements or config values

Curl Code Sample: Retrieve File Revision Info

The following command retrieves information regarding the revisions of file "foo" attached to page "bar":

Sample Code

curl -u username:password -i http://mindtouch.address/@api/deki/pages/=foo/files/=bar/revisions

Sample Response from executing Code

This response indicates a file attachment was revised once, thus two available revisions (namely the old and current one).

<files count="2" totalcount="2" href="http://192.168.59.128/@api/deki/files/73/revisions?changefilter=content">
  <file id="73" revision="1" href="http://192.168.59.128/@api/deki/files/73/info?revision=1">
    <filename>picard.jpg</filename>
    <description/>
    <contents type="image/jpeg" size="19637" width="500" height="324" href="http://192.168.59.128/@api/deki/files/73/=picard.jpg?revision=1"/>
    <contents.preview rel="thumb" type="image/jpeg" maxwidth="160" maxheight="160" href="http://192.168.59.128/@api/deki/files/73/=picard.jpg?revision=1&size=thumb" revision="1"/>
    <contents.preview rel="webview" type="image/jpeg" maxwidth="550" maxheight="550" href="http://192.168.59.128/@api/deki/files/73/=picard.jpg?revision=1&size=webview" revision="1"/>
    <date.created>2010-01-29T19:54:15Z</date.created>
    <user.createdby id="1" href="http://192.168.59.128/@api/deki/users/1">
      <nick>Admin</nick>
      <username>Admin</username>
      <email hidden="true"/>
      <hash.email>64e1b8d34f425d19e1ee2ea7236d3028</hash.email>
      <uri.gravatar>http://www.gravatar.com/avatar/64e1b8d34f425d19e1ee2ea7236d3028</uri.gravatar>
    </user.createdby>
    <user-action type="content, name, parent"/>
    <page.parent id="569" href="http://192.168.59.128/@api/deki/pages/569?redirects=0">
      <uri.ui>http://192.168.59.128/Starfleet</uri.ui>
      <title>Starfleet</title>
      <path>Starfleet</path>
      <namespace>main</namespace>
    </page.parent>
  </file>
  <file id="73" revision="2" href="http://192.168.59.128/@api/deki/files/73/info?revision=2">
    <filename>copyright.png</filename>
    <description/>
    <contents type="image/png" size="12557" width="354" height="354" href="http://192.168.59.128/@api/deki/files/73/=copyright.png?revision=2"/>
    <contents.preview rel="thumb" type="image/png" maxwidth="160" maxheight="160" href="http://192.168.59.128/@api/deki/files/73/=copyright.png?revision=2&size=thumb" revision="2"/>
    <contents.preview rel="webview" type="image/png" maxwidth="550" maxheight="550" href="http://192.168.59.128/@api/deki/files/73/=copyright.png?revision=2&size=webview" revision="2"/>
    <date.created>2010-01-29T19:54:29Z</date.created>
    <user.createdby id="1" href="http://192.168.59.128/@api/deki/users/1">
      <nick>Admin</nick>
      <username>Admin</username>
      <email hidden="true"/>
      <hash.email>64e1b8d34f425d19e1ee2ea7236d3028</hash.email>
      <uri.gravatar>http://www.gravatar.com/avatar/64e1b8d34f425d19e1ee2ea7236d3028</uri.gravatar>
    </user.createdby>
    <user-action type="content, name"/>
    <page.parent id="569" href="http://192.168.59.128/@api/deki/pages/569?redirects=0">
      <uri.ui>http://192.168.59.128/Starfleet</uri.ui>
      <title>Starfleet</title>
      <path>Starfleet</path>
      <namespace>main</namespace>
    </page.parent>
  </file>
</files>

Implementation notes 

curl flags

-u
Provides external user authentication. Note that if anonymous access is available and authentication is not forced, this flag may be omitted.
-i
Outputs the HTTP response headers. Useful for debugging.

Attached files

To view a list of all files attached to a page, follow the instructions here.

 

  • Was this article helpful?