Skip to main content
NICE CXone Expert
Expert Success Center

archive/files/{fileid} (GET)

Overview

Retrieves file content for a deleted file

  • REST Method: GET
  • Method Access: public

Uri Parameters

Name Type Description
filename string "=" followed by a double uri-encoded file name
fileid int identifies a file by ID

Query Parameters

Name Type 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 Administrator access is required
Not Found 404 Requested file could not be found in the archive

Message Format

None

Implementation Notes

When a file is deleted, it is moved into the archive. It will remain in the archive until it is either permanently deleted (DELETE:archive/files/{fileid}) or restored (POST:archive/files/restore/{fileid}).  While a file is in the archive, it cannot be modified.

The Content-Disposition, Content-Length, and Content-Type headers provide information about the retrieved file.

C# Code Sample: Retrieve an Archived File

The following code example retrieves the archived file with ID 456 and saves it in the caller's temporary directory:

Sample Code

Plug p = Plug.New("http://deki-hayes/@api/deki");
p.At("users", "authenticate").WithCredentials("admin", "password").Get();
DreamMessage msg = p.At("archive", "files", "456").Get();
using (FileStream fs = System.IO.File.OpenWrite(Path.GetTempPath() + msg.ContentDisposition.FileName)) 
{
    byte[] fileData = msg.AsBytes();
    fs.Write(fileData, 0, fileData.Length);
}

Implementation notes 

Add notes about requirements or config values

Curl Code Sample: Retrieve an Archived File

The following command retrieves a file with file.archive ID = 1:

Sample Code

curl -u admin:password -i http://mindtouch.address/@api/deki/archive/files/1

Implementation notes 

curl flags

-u
Provides external user authentication.
-i
Outputs the HTTP response headers. Useful for debugging.

Permissions

ADMIN permission is required to execute above command.

Response

Note that a file, not an XML document, is returned. So if an image or any non-text file is requested, a bunch of junk will very possibly be returned to the console.

Archived Files

To view a list of archived files, follow the instructions here.
  • Was this article helpful?