Validation
Table of contents
- 1. API Validation
- 1.1. Supported payload content-types
- 1.2. Compressing the payload
- 1.3. HTTP Method
- 1.3.1. POST /v1/validate/{pcode}
- 1.4. Possible error messages
- 1.4.1. 401 unauthorized
- 1.4.2. 500 Internal server error
- 1. API Validation
- 1.1. Supported payload content-types
- 1.2. Compressing the payload
- 1.3. HTTP Method
- 1.3.1. POST /v1/validate/{pcode}
- 1.4. Possible error messages
- 1.4.1. 401 unauthorized
- 1.4.2. 500 Internal server error
API Validation
Validation resource takes a file for validation. Validation is asyncrohonous process where input data is queued for validation. The validation results are not returned by Validate -resource but instead following data is returned:
- Location pointing to object in Queue - returned in response Header
- Queue Id which is unique identifier for the validation in the queue - returned in response Body
Supported payload content-types
File data can be sent to validate -resource in the the following formats:
- multipart/form-data
- text/xml
- text/plain
- application/zip
- text/xml
- text/plain
- application/zip
Compressing the payload
File payload can, and is recommended to be compressed to ZIP binary data before sending it to the XMLdation API Service. If binary data is detected as valid ZIP file, XML file inside the compressed ZIP is extracted and validated automatically.
Note that for multipart/form-data payload the file is considered as ZIP binary in following cases: mimetype is application/zip OR filename extension is .zip. Otherwise payload is handled as XML data.
HTTP Method
POST /v1/validate/{pcode}
Example request with XML File
curl -k -H "Authorization: Bearer Token" -H "Content-Type:application/xml" -X POST -d "@paymentfile.xml" https://<service_or_demo>.xmldation.com/api/v1/validate/1234placeholder
Where
- Token is the access_token received via the authentication
- 1234placeholder is the desired validation pipe name
- paymentfile.xml is the xml file for validation on your local filesystem
Example request with ZIP File.
zip payment.xml.zip payment.xml curl -k -H "Authorization: Bearer Token" -H "Content-Type:application/zip" -X POST --data-binary "@paymentfile.xml.zip" https://<service_or_demo>.xmldation.com/api/v1/validate/1234placeholder
Where
- Token is the access_token received via the authentication
- 1234placeholder is the desired validation pipe name
- paymentfile.xml.zip is the zip archive for validation on your local filesystem
Example Response
Header | Content |
Location: | /queue/69f4e0c2-16c6-4c91-97b0-16be708ec082 |
HTTP/1.1 202 Accepted
{ "response" : { "status" : "Added to Validation Queue", "id" : "69f4e0c2-16c6-4c91-97b0-16be708ec082" } }
To access queue item, please refer to Validation Queue.
Possible error messages
401 unauthorized
HTTP/1.1 status 401 will be returned in the following scenarios:
- In cases of invalid credentials
- {pcode} does not exists
- Given username does not have permission to {pcode}
For additional information see Authentication.
500 Internal server error
HTTP/1.1 status 500 will be returned in the following scenarios:
- Missing payload
- Given content-type is not supported. For supported content-types see section "Supported payload content-types"
- Unexpected error occurred. Contact XMLdation Support at support@xmldation.com