Toggle menu

unpackSecureFileReferences

Unpacks a secure file reference for a file which has previously been generated using generateSecureFileReferences. Multiple file references can be unpacked in a single call.

Request Parameters

NameTypeComments
userNamesArray<String>, requiredUsernames to use to decrypt the reference, typically the name of the currently logged in user and perhaps the anonymous user. Must match the username supplied when the reference was generated for decryption to be successful
secureReferencesArray<String>, requiredThe secure references to unpack
formsServiceClientIdCookieString<UUID>, optionalUsed in combination with formSessionId in generateSecureFileReferences to secure a file reference. If both are set they must match before the file can be downloaded. This check is handled by the forms service

Error Types

The errorType field of the part of the response corresponding to a specific reference to be unpacked may contain any of the following strings.

Error TypeDescription
NOT_FOUNDThe reference was unpacked but refers to a file that does not exist in the database
EXPIREDThe reference was unpacked but has expired
BAD_FORMATThe reference was not of the expected format, eg did not contain the expected prefix "SFR-"
FAILEDThe reference could not be unpacked, most likely because none of the supplied usernames matched the one it was encrypted with, but all other errors are also covered by this case
UNAUTHORIZEDThe formsServiceClientIdCookie checking failed

Example Request

{
    "id": "testreq1",
    "method": "unpackSecureFileReferences",
    "params": {
        "userNames": ["joebloggs", "anonymous"],
        "secureReferences": ["SFR-AmNZEGKPzjv6gOioph6GhBHZKloRnL7W6RnRAMmO_T6uQvRC0XiI3Y2K0s9IJnRtsMaN0yBJez6ynPdiaTBpOr-VVIBJ14LEXjmc0CgLIJLaj0jZz5GY6g"]
    },
    "jsonrpc": "2.0"
}

Example Response

{
    "result": {
        "result": {
            "SFR-AmNZEGKPzjv6gOioph6GhBHZKloRnL7W6RnRAMmO_T6uQvRC0XiI3Y2K0s9IJnRtsMaN0yBJez6ynPdiaTBpOr-VVIBJ14LEXjmc0CgLIJLaj0jZz5GY6g": {
                "success": true,
                "fileID": "20296502-c509-4178-8ede-841048aaf984"
            }
        }
    },
    "id": "testreq1",
    "jsonrpc": "2.0"
}

Last modified on June 27, 2023

Share this page

Facebook icon Twitter icon email icon

Print

print icon