Feedback using "SuccessCallback" and "Userdata"
This chapter explains how to receive feedback about the saving process. In addition, you can provide the user with various options in the storage dialog. If the saving process was successful, you can analyze the options that were selected by a user in your source system. However, you can also receive feedback without having provided options to the user.
Providing options for the user in the storage dialog
In addition to the mapping process data, you can display various options to your users in the storage dialog. The user can select one of the options. In order to make these options available, add the userdata
array to the JSON object sourceProperties
. For more information see Defining the parameters for storing.
You can suggest a possible selection to the user. If you do not suggest an option, the user must select an option him/herself prior to saving the DMS object. Once saving has been successfully performed, the option selected by the user is transferred to the (successCallbackUri
) URL.
The JSON object sourceProperties
with the userdata
array looks as follows:
{ "properties": [ ... ], "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"} ] }] }
Feedback after successfully saving
If you would like to receive feedback, specify the successCallbackUri
parameter as soon as the DMS object was successfully saved. You will receive an HTTP POST
request for this URL with a JSON object in the request.
The request to send a DMSApp could appear as follows:
Request
POST /myapp/sources/mysource/myfile/success Origin: https://baseuri Accept: application/hal+json Content-Type: application/hal+json { "_links": { "dmsobjectwithmapping": { "href": "/dms/r/dee1f3d3-eae8-5d9d-84d8-2d758c5ddc27/o2m/D000001234?sourceId=%2Fmyapp%2Fsources%2Fmysourc" } }, "userdata": [ { "postProcessingOption": ["2"] } ] }
Description of the JSON object that is transferred for POST
:
Property | Description |
---|---|
| Contains the |
| Specifies the array with the results of which options a user had selected as name-value pair (key value). The |
Provide a corresponding HTTP status code as a response to the request of the DMSApp. Based on your status code, the storage dialog displays a corresponding success or error message. You can transmit additional information in your response as a JSON object.
Example of your response for a request:
Response
HTTP/1.1 400 BadRequest { "reason": "My error message", "severity": 3 }
Description of the parameters for the response to the request:
Property | Description |
---|---|
| An optional short description of why the error has occurred. This text is used as the error message’s title. |
| An optional message for the user containing troubleshooting tips. |
| Optional detailed information about the error. |
| Optional error severity. Possible values are: Success = 0, Information = 1, Warning = 2, Error = 3 |