# Data validation

The Data Validation service is a request/response-based process. It provides a mechanism for attaching data points to a page in a Digital River store and validating each data point against an external endpoint provided by a third-party client.

![Data Validation Service flow](https://files.readme.io/b9b0bce-Data_Validation_Service.png)

## Data validation details

A successful Data Validation request results in a response that contains a non-null, non-empty element. An unsuccessful Data Validation request results in an invalid response code (`responseCode`).

#### Note

A third-party client must define the `responseCode.`

{% tabs %}
{% tab title="Payload" %}

```json
{
	"DataValidationRequest": {
		"dataPoints": {
			"item": [
				{
					"name": {
						"_xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
						"_xsi:type": "xsd:string",
						"__text": "CustomerID"
					},
					"value": {
						"_xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
						"_xsi:type": "xsd:string",
						"__text": "12345"
					},
					"valueDataType": {
						"_xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
						"_xsi:type": "xsd:string",
						"__text": "string"
					},
					"_xsi:type": "ns1:DataPointInfo"
				},
				{
					"name": {
						"_xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
						"_xsi:type": "xsd:string",
						"__text": "SRPID"
					},
					"value": {
						"_xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
						"_xsi:type": "xsd:string",
						"__text": "67890"
					},
					"valueDataType": {
						"_xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
						"_xsi:type": "xsd:string",
						"__text": "string"
					},
					"_xsi:type": "ns1:DataPointInfo"
				}
			],
			"_xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
			"_xsi:type": "ns1:DataPointInfos"
		},
		"extendedAttributes": {
			"_xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
			"_xmlns:ns2": "http://integration.digitalriver.com/Common/1.0",
			"_xsi:type": "ns2:ExtendedAttributesInfoArray",
			"_xsi:nil": "true"
		},
		"_xmlns:ns1": "http://integration.digitalriver.com/DataValidationService",
		"__prefix": "ns1"
	}
}
```

{% endtab %}

{% tab title="Successful response" %}

```json
{
	"DataValidationResponse": {
		"dataPointResponses": {
			"item": [
				{
					"name": {
						"_xmlns": "",
						"_xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
						"_xsi:type": "xsd:string",
						"__text": "CustomerID"
					},
					"value": {
						"_xmlns": "",
						"_xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
						"_xsi:type": "xsd:string",
						"__text": "12345"
					},
					"valueDataType": {
						"_xmlns": "",
						"_xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
						"_xsi:type": "xsd:string",
						"__text": "string"
					},
					"_xsi:type": "ns1:DataPointResponseInfo"
				},
				{
					"name": {
						"_xmlns": "",
						"_xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
						"_xsi:type": "xsd:string",
						"__text": "SRPID"
					},
					"value": {
						"_xmlns": "",
						"_xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
						"_xsi:type": "xsd:string",
						"__text": "67890"
					},
					"valueDataType": {
						"_xmlns": "",
						"_xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
						"_xsi:type": "xsd:string",
						"__text": "string"
					},
					"_xsi:type": "ns1:DataPointResponseInfo"
				}
			],
			"_xmlns": "http://integration.digitalriver.com/DataValidationService",
			"_xsi:type": "ns1:DataPointResponseInfos"
		},
		"valid": {
			"_xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
			"_xsi:type": "xsd:boolean",
			"__text": "true"
		},
		"_xmlns:ns1": "http://integration.digitalriver.com/DataValidationService",
		"_xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
		"_xsi:type": "ns1:DataValidationResponse",
		"__prefix": "ns1"
	}
}
```

{% endtab %}

{% tab title="Unsuccessful response" %}

```json
{
	"DataValidationResponse": {
		"dataPointResponses": {
			"item": [
				{
					"name": {
						"_xmlns": "",
						"_xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
						"_xsi:type": "xsd:string",
						"__text": "CustomerID"
					},
					"value": {
						"_xmlns": "",
						"_xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
						"_xsi:type": "xsd:string",
						"__text": "12345"
					},
					"valueDataType": {
						"_xmlns": "",
						"_xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
						"_xsi:type": "xsd:string",
						"__text": "string"
					},
					"_xsi:type": "ns1:DataPointResponseInfo"
				},
				{
					"name": {
						"_xmlns": "",
						"_xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
						"_xsi:type": "xsd:string",
						"__text": "SRPID"
					},
					"value": {
						"_xmlns": "",
						"_xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
						"_xsi:type": "xsd:string",
						"__text": "67890"
					},
					"valueDataType": {
						"_xmlns": "",
						"_xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
						"_xsi:type": "xsd:string",
						"__text": "string"
					},
					"_xsi:type": "ns1:DataPointResponseInfo"
				}
			],
			"_xmlns": "http://integration.digitalriver.com/DataValidationService",
			"_xsi:type": "ns1:DataPointResponseInfos"
		},
		"valid": {
			"_xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
			"_xsi:type": "xsd:boolean",
			"__text": "false"
		},
		"responseCode": {
			"_xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
			"_xsi:type": "xsd:string",
			"__text": "DATA_VALIDATION_INVALID"
		},
		"_xmlns:ns1": "http://integration.digitalriver.com/DataValidationService",
		"_xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
		"_xsi:type": "ns1:DataValidationResponse",
		"__prefix": "ns1"
	}
}
```

{% endtab %}
{% endtabs %}

## Data validation schema

The data validation schema serves as a blueprint for validating data requests. It ensures that the data points and their respective types comply with predefined standards, leading to successful data validation responses. Refer to the links in the table below for more details on the schema components, raw schema, and sample XML.

| Version             | Schema Components Table                                                                       | Raw Schema                                                                        | Sample XML                                                                                |
| ------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| Version 1 (Current) | [View](https://drhadmin.digitalriver.com/integration/isg/schematable/DataValidationService/1) | [View](https://drhadmin.digitalriver.com/integration/xsd/DataValidationService/1) | [View](https://drhadmin.digitalriver.com/integration/isg/example/DataValidationService/1) |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digitalriver.com/commerce-api/shopper-apis/shoppers/managing-shoppers/data-validation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
