Validates the integrity of the file store by checking:
- That all files referenced by file records in the database exist on the file system
- [Optionally] That the hash of the stored file in the file record matches that of the file on the file system, ie whether the file has changed on disk since it was stored
An entry is returned in the response for each invalid file keyed by the public file identifier. The entry contains the reason that the file was found to be invalid. The reason can be either:
- FILE_NOT_FOUND - A file record exists on the database, but the file does not exist on disk
- STORAGE_FILE_HASH_DOES_NOT_MATCH_ORIGINAL - The hash of the file on disk does not match that stored in the file record (the file has changed on disk since it was stored). Can only be returned if the checkFileHashes=true parameter was supplied
Request Parameters
All parameters are optional.
Name | Type | Comments |
---|---|---|
purgeInvalidFiles | Boolean | If true, invalid entries will be deleted from the database and file system rather than just being reported in the method response |
detailedFileInfo | Boolean | If true, will return the full file record for each invalid file. Note that this will significantly increase the size of the response |
checkFileHashes | Boolean | Whether the stored file should be hashed, and that hash compared for equality against the hash of the file taken at upload and stored in the file record - ie whether to check that stored files haven't changed since on disk since they were uploaded of all otherwise valid stored files. Files that fail this check will return a failure reason of STORAGE_FILE_HASH_DOES_NOT_MATCH_ORIGINAL. Note that this option will significantly increase the response time of this method as every valid file in the file store must be hashed |
Example Request
Example response - Success
{
"bc322ac3-c801-4033-91ee-5696a9f7601a": {
"reason": "FILE_NOT_FOUND",
"fileDetails": {
"lastUpdated": "2016-07-25T15:52Z",
"lastUpdatedBy": null,
"filename": "testFile1.txt",
"size": 39,
"references": [],
"createdBy": null,
"created": "2016-07-25T15:52Z",
"id": "bc322ac3-c801-4033-91ee-5696a9f7601a",
"type": "text/plain",
"hash": "578d6d617187adb12908b059e80230e4"
},
"01b46e76-8406-4398-bab4-f758cf2c1bd2": {
"reason": "STORAGE_FILE_HASH_DOES_NOT_MATCH_ORIGINAL",
"fileDetails": {
"lastUpdated": "2015-02-12T08:52Z",
"lastUpdatedBy": null,
"filename": "testFile2.txt",
"size": 39,
"references": [],
"createdBy": null,
"created": "2015-02-12T08:52Z",
"id": "01b46e76-8406-4398-bab4-f758cf2c1bd2",
"type": "text/plain",
"hash": "a3dcb4d229de6fde0db5686dee47145d"
}
}
}
}