Using Validate Option

You can use this function to validate the REST API. Therefore, this feature provides a framework to call the validation REST API that was defined in the REST account during the Template/Transaction creation.

This feature is only visible when:

  • You have selected the Enable External Mapping Validation checkbox and REST account from Template/Transaction settings page.
  • You open the mapper from the Define Mapping page of Template/Transaction.

This feature is not supported if you open mapping from Manage Objects page.

Steps to validate REST API

  1. Open the mapping from Define Mapping page of Template/Transaction.

  2. Click Validate icon from the toolbar of mapper.



    This will call the validation REST API that was defined in the REST account during the Template/Transaction creation

  3. This will validate the REST API.

  4. After validation:
    1. A message is displayed to confirm that the validation is completed without any error.
    2. The validate icon will change into Validated.
    3. In case of any validation error, the errors will be displayed.

Request/Response for the External Mapping Validation

The External Mapping Validation provides the way to validate the rules of the destination elements using REST API that was defined in the REST account during the Template/Transaction creation. Following are the Request and Response JSON format for External Mapping Validation in Web Mapper.

Request Format for the External Mapping Validation

Following example presents the request format of API for the layout shown in the below image:


 

Request Format
{
	"destinationDetails": [{
			"fieldName": "Root",
			"MinOccurs": "1",
			"MaxOccurs": "1",
			"leaf": false,
			"schemaName": "AC_TextSchema_Traget",
			"fieldPath": "/Root"
		},
		{
			"fieldName": "Record",
			"MinOccurs": "1",
			"MaxOccurs": "unbounded",
			"leaf": false,
			"schemaName": "AC_TextSchema_Traget",
			"fieldPath": "/Root/Record"
		},
		{
			"fieldName": "Field1",
			"parent": " ",
			"Documentation": "",
			"BaseType": "string",
			"MinOccurs": "0",
			"MaxOccurs": "1",
			"leaf": true,
			"schemaName": "AC_TextSchema_Traget",
			"isMapped": true,
			"fieldPath": "/Root/Record/Field1"
		},
		{
			"fieldName": "@recordNumber",
			"Documentation": "",
			"isAttribute": "true",
			"leaf": true,
			"BaseType": "string",
			"schemaName": "AC_TextSchema_Traget",
			"fieldPath": "/Root/Record/@recordNumber"
		}
	],
	"sourceDetails": [{
			"fieldName": "Root",
			"MinOccurs": "1",
			"MaxOccurs": "1",
			"leaf": false,
			"schemaName": "AC_TextSchema_Source",
			"fieldPath": "/Root"
		},
		{
			"fieldName": "Record",
			"MinOccurs": "1",
			"MaxOccurs": "unbounded",
			"leaf": false,
			"schemaName": "AC_TextSchema_Source",
			"fieldPath": "/Root/Record"
		},
		{
			"fieldName": "Field1",
			"parent": " ",
			"Documentation": "",
			"BaseType": "string",
			"MinOccurs": "0",
			"MaxOccurs": "1",
			"leaf": true,
			"schemaName": "AC_TextSchema_Source",
			"isMapped": true,
			"fieldPath": "/Root/Record/Field1"
		},
		{
			"fieldName": "@recordNumber",
			"Documentation": "",
			"isAttribute": "true",
			"leaf": true,
			"BaseType": "string",
			"schemaName": "AC_TextSchema_Source",
			"fieldPath": "/Root/Record/@recordNumber"
		}
	],
	"mappingDetails": {
		"cloneElements": "",
		"filters": "",
		"variables": {
			"variable": [

			]
		},
		"globalParameters": {
			"keys": {
				"key": [

				]
			},
			"contextVariables": {
				"contextVariable": [

				]
			}
		},
		"connections": {
			"connectionVariable": [

			]
		},
		"functions": {
			"externalFunction": [

			]
		},
		"filterUnmappedElements": false,
		"indentOutputXML": true,
		"xslVersion": "1.1",
		"enableStreaming": false,
		"filterEmptyElements": false,
		"xslTransformer": "Saxon",
		"characterSetEncoding": "ISO-8859-1",
		"disableOuputNodes": {
			"disableOutputNodeProperty": [

			]
		},
		"GlobalPreCustomXSL": "",
		"GlobalPostCustomXSL": "",
		"xslTemplates": {
			"xslTemplateData": [

			]
		},


		"namespace": "",
		"namespaceList": [

		],
		"contextSchemaDefinition": "",
		"maps": [{
			"order": 1,
			"targetName": "AC_TextSchema_Traget",
			"targetfield": "Field1",
			"targetfieldpath": "/Root/Record/Field1",
			"targetrecord": "Record",
			"mapping": [{
				"sourceName": "AC_TextSchema_Source",
				"operatortype": "field",
				"sourcefield": "Field1",
				"sourcefielddisplayname": "Field1",
				"sourcefieldpath": "/Root/Record/Field1",
				"sourcerecord": "Record"
			}]
		}]
	}
}

Request JSON has these three details:

Destination Details: This shows the details of each element of destination layout.

Source Details: This shows the details of each element of source layout.

Mapping Details: This shows the mapping details applied on destination layout.

Response Format for the External Mapping Validation

These information must available in Response JSON:

In case the Validation is successful

{"status":"success","errorDetails":{}}

In case the validation is not successful

{ "status":"error",

 "errorDetails":{

"/Root/Record/Field1" :{

"message": "Field1 is mandatory.",

"schemaName" : "AC_TextSchema_Target"

},

"/Root/Record/@recordNumber" :{

"message": "@recordNumber is mandatory.",

"schemaName" : "AC_TextSchema_Target"

}

}

}


Where,

Status: This shows the validation status 'error or success'. If success, error details will be blank otherwise error details contains the list of field path which are having errors.

Error Details: This contains the field path. 

Field Path: This contains message and schema name.