Defining the parameters for storing

In this chapter, you learn more about the parameters you can use to store DMS objects. The parameters are applicable for storing with or without user action.

Setting a JSON object for storing

The JSON object that is sent with the HTTP requests for storing a DMS object includes the following parameters:

Property

Description

displayValue

Specifies the display name of the item that is stored. The display name will become visible to the user in the storage dialog. This parameter is optional.

filename

Specifies the name of the file to be stored with the file extension.

If you set this parameter, you need to map the category which you specified under sourceCategory in the mapping processing for a document type. If you do not set this property, you need to map the category which you specified under sourceCategory the in mapping processing for a dossier type.

  • The property is mandatory if you are resaving a document.

  • This property is optional if you are updating a document. If the parameter is not set, the old file name will be used.

  • The property is ignored if you update a document without contentLocationUri or contentUri .

  • The property must not be set when you create or update a new dossier.

dmsObjectId

Specifies the ID of the DMS object to be updated. This parameter is taken into account when updating a DMS object with user interaction.

alterationText

Specifies the reason for change for the update of a DMS object. In d.3 admin, you define whether the parameter has to be entered. This parameter is taken into account only when updating a DMS object.

sourceCategory

Specifies which category should be used for mapping processing while storing. Enter the ID of the source category.

This property must be specified except under the following circumstances:

  • The property is ignored if the parameter parentId is set and an associated default category has been defined in d.3 admin.

  • The property is ignored when you update a DMS object.

  • The property is optional if an item is stored via user action.

If you store multiple DMS objects via user action, then only the source category of the first item in the storeObjects array in the storage dialog is taken into account. This source category is displayed to the user for all additional files to be stored.

sourceId

Defines the source to which the mapping that is to be used for storing belongs. The source must exist and the source system must be registered with d.ecs http gateway so that the properties under sourcePropertiesUri or sourceProperties can be applied.

For more information about providing a source see Defining the parameters for storing.

If you do not have your own source system, you can also use the default source system of the d.3 repository. For information on the standard source system, see Retrieving the default source system for a d.3 repository.

sourcePropertiesUri

Specifies the URL through which the DMSApp should download the item properties for the mapping processing and duplicate check. Before storing the DMS object, the DMSApp sends an HTTP GET request to the URL in order to determine the source properties for the storage process. If the sourcePropertiesUri is a relative URL, the user information of the registered user is also transmitted in the HTTP request (AuthSessionID). This makes it possible to take the current user name into account or perform a permission check, for example. In the case of an absolute URL, the source properties are requested anonymously. The JSON object to be provided is described under "Setting the source properties."

Alternatively, you can use the sourceProperties property.

sourceProperties

Specifies a JSON array with source properties that are used for mapping processing and duplicate check. The JSON object to be provided is described under "Setting the source properties."

Alternatively, you can use the sourcePropertiesUri property.

contentLocationUri

Specifies the URL for the file that was temporarily uploaded. For more information, see Providing a file via temporary upload.

Alternatively, you can use the contentUri property.

If you set this parameter, you need to map the category which you specified under sourceCategory the in mapping processing for a document type. If you do not specify neither the contentLocationUri nor the contentUri property, you need to map the category which you specified under sourceCategory in the mapping processing for a dossier type.

This property is optional if you want to update a DMS object or create a dossier.

contentUri

Specifies the relative URL through which the DMSApp downloads the file to be stored. For more information, see Providing a file via temporary upload.

Alternatively, you can use the contentLocationUri property.

If you set this parameter, you need to map the category which you specified under sourceCategory the in mapping processing for a document type. If you do not specify neither the contentLocationUri nor the contentUri property, you need to map the category which you specified under sourceCategory in the mapping processing for a dossier type.

This property is optional if you want to update a DMS object or create a dossier.

parentId

Specifies the DMS object ID of the dossier with which the item to be stored should be linked. If the storage process is successful, the stored item is linked to the corresponding dossier. If the item to be stored is recognized as a duplicate, the already existing item is linked to the dossier.

However no duplicate check performed, when you want to link a dossier to another dossier.

This property is ignored when you update a DMS object.

successCallbackUri

Specifies the URL that is opened via HTTP POST when the storage process was performed successfully. The URL must be relative. For more information see Feedback using "SuccessCallback" and "Userdata".

This property is optional. You can use the property only when storing with user interaction.

Setting the source properties

You can define the source properties directly using the sourceProperties parameter or provide them using the URL in sourcePropertiesUri.

The JSON object is described as follows:

Property

Description

properties

Specifies an array of the source properties that are provided for mapping processing. Only the properties that were configured by the administrator in the mapping are taken into consideration when storing.

uniqueTag

Specifies a unique hashcode that is used by the source for the item to be stored and by the d.3 server for duplicate recognition. Setting this property is optional.

userdata

Specifies an array of options that should also be displayed in the storage dialog. Specifying this property is optional. You can use the property only when storing with user interaction.

For more information see Feedback using "SuccessCallback" and "Userdata".

checkHash

Indicates the hash of the file to be stored. The hash of the file to be stored helps you to validate the file saving process in a d.3 repository. If the hashes do not match, the document saving process is terminated with an error message.

While saving the file, a hash of the file is generated by the server, compared with the hash that you generate and validated. In this case, the parameter must have the following structure:

HASHALGORITHM:base64encode(hashfunction(PAYLOAD))

Example of a file with the content "Example":

SHA512:xrCRnH/mKK6QVpksSpF+XcA1qWFdSX9usr0UBj6q0+ZQjvyGgv7IKCPKPz3jEYaKcpkJRhZkKfAbOPnzPZymEA==

The following hash algorithms are supported:

  • RIPEMD256

  • SHA256

  • SHA384

  • SHA512

  • MD5

This parameter is optional.

Always perform Base64 encoding at the byte level. Encoding a textual representation results in invalid hash values.

Examples of generating a checkHash value using the classes from System.Security.Cryptography in C#:

private string CreateM5Hash(string filename)
{
   using (var md5 = MD5.Create())
   {
       using (var stream = File.OpenRead(filename))
       {
             var retVal = md5.ComputeHash(stream);
                         //Bytes in retVal für eine Datei mit dem Inhalt "Example": 
                 //45 155 209 108 21 173 26 160 179 111 217 119 62 110 20 172

             return $"MD5:{Convert.ToBase64String(retVal)}"; 
                 //Hash base64-encodiert:   
                         //MD5:ClJzBZf7T/oB/BF9nnHjqQ==        
                }
   }
}

private string CreateSHA256Hash(string filename)
{
    using (var sha256 = SHA256.Create())
    {
        using (var stream = File.OpenRead(filename))
        {
            var retVal = sha256.ComputeHash(stream);
                    //Bytes in retVal für eine Datei mit dem Inhalt "Example":  
                        //53 239 154 101 221 213 246 176 70 65 37 206 150 167 54 152 
                        //63 65 154 140 96 227 200 169 71 112 149 213 153 156 17 27

            return $"SHA256:{Convert.ToBase64String(retVal)}";
                    //Hash base64-encodiert: 
                        //SHA256:0Cn4fj2A+P2bG+Z8dCa0zB/0e0qdCoRhyCalnYxets0= 
        }
    }
}

private string CreateSHA512Hash(string filename)
{
    using (var sha512 = SHA512.Create())
    {
        using (var stream = File.OpenRead(filename))
        {
            var retVal = sha512.ComputeHash(stream);
                        //Bytes in retVal für eine Datei mit dem Inhalt "Example":   
                        //72 237 177 122 242 252 39 57 63 98 44 167 119 228 162 20 106 
                        //147 201 76 246 223 209 126 97 224 198 30 40 137 121 216 147 
                        //21 15 16 1 103 84 101 60 241 95 82 14 126 211 137 170 235 180 
                        //206 18 112 247 228 229 185 208 62 192 244 131 41

            return $"SHA512:{Convert.ToBase64String(retVal)}";
                //Hash base64-encodiert:  
                        //SHA512:xrCRnH/mKK6QVpksSpF+XcA1qWFdSX9usr0UBj6q0+ZQjvyGgv7IKCPKPz3jEYaKcpkJRhZkKfAbOPnzPZymEA== 
        }
    }
}

Structure of an object in the "property" array

Property

Description

key

Specifies the ID of the source property. Only the properties that you specified and that were configured by the administrator in the mapping are taken into account.

When updating a DMS object, only the properties that you specified are updated. All the other values for the existing DMS object properties are retained.

When you want to specify the creation date (property_creation_date) of the DMS object, the specification of the property is only considered when a new DMS object is saved without any user interaction. For more information see Storing a new DMS object without user interaction.

values

Specifies an array with the corresponding values of the item property. Even if you only want to transmit one value, you must transmit this value as a JSON array.

You can set the d.3 document status for a DMS object when storing a new DMS object. The values available are Processing, Verification and Release.

During a DMS object update, mappings for the d.3 document status, d.3 variant number, d.3 document ID and d.3 document number are ignored.

Properties with the tag "read-only" are not considered while storing the item.

During an update without user interaction, the authenticated user must be the processor of the DMS object if the existing DMS object has the Processing d.3 document status.

Specify the numerical value without using a thousand separator. The decimal separator is the period (.). Example: For the value 1,000.20 EUR specify 1000.20.

Specify the date values in the format YYYY-MM-DD. Example: Enter 2014-12-05 for the date 12/05/2014 (MM/DD/YYYY).

Enter date and time values in the format YYYY-MM-DDTHH:mm:ss+01:00. Example: 2015-02-18T23:59:59+01:00 for 2/18/2015 at 11:59 p.m. and 59 seconds in the time zone UTC+1 for standard time in Germany.

Example 1: Providing the file and the properties via a URL 

A simple JSON object could appear as follows:

{
    "filename": "myfile.txt",
        "alterationText": "updated file",
    "sourceCategory": "mycategory1_ID",
    "sourceId": "/myapp/sources/mysource",  
    "contentUri": "/myapp/sources/mysource/myfile.txt",
    "sourcePropertiesUri": "/myapp/sources/mysource/myfile.haljson"    
}

Example 2: The properties, including the "userdata" and "successCallbackUri" parameters, are directly specified.

The following JSON object contains userdata and the properties (properties). uniqueTag is set at the same time for the duplicate check. The dossier ID is set in the parentId parameter in order to link the DMS object to be recreated:

{
    "displayValue": "Please verify the XYZ invoice",
    "filename": "myfile.txt",
        "alterationText": "updated file",
    "sourceCategory": "mycategory1_ID",
    "sourceId": "/myapp/sources/mysource",
    "parentId": "P123456789",
    "contentLocationUri": "/dms/r/dee1f3d3-eae8-5d9d-84d8-2d758c5ddc27/blob/chunk/2018-01-01_temp_master_file_user1_44f7-95a6-58b8400ecf43",
    "successCallbackUri": "/myapp/sources/mysource/myfile/success",
    "sourceProperties": {
        "properties": [{
                "key": "myprop1_ID",
                "values": ["Please verify the XYZ invoice"]
            },
            {
                "key": "myprop2_ID",
                "values": ["Name1@contoso.com","Name2@samplecompany.de"]
            }
        ],
                "userdata": [{
                    "key": "postProcessingOption",
                        "display": "My post processing options",
                "values": [
                        {"value":"1", "display": "Action 1", "default":"false"},
                        {"value":"2", "display": "Default action 2", "default":"true"},
                        {"value":"3", "display": "Action 3", "default":"false"}
                ]
                }
        ],
                "uniqueTag": "123456789",
                "checkHash": "MD5:ClJzBZf7T/oB/BF9nnHjqQ=="
    }
}