Link Search Menu Expand Document (external link)

Document validation

Table of contents
  1. Endpoint
  2. URL parameter description
  3. Request body parameter description
  4. Response body parameter description
    1. Successful response
    2. Failed response
  5. Sample request
  6. Sample response
    1. Sample success response
    2. Sample failed response
  7. Implementation
    1. CURL
    2. Using php-client

Short description

Endpoint

Path (Locale: LT) /api/v2/document/{documentId}/validation.json
Path (Locale: EN) /en/api/v2/document/{documentId}/validation.json
Method POST
Request Body Schema application/json

URL parameter description

Key Requirement Type Description
documentId Mandatory String Document UUID from response of “Document upload”

Request body parameter description

Key Requirement Type Description
access_token Mandatory String API Access Token

Response body parameter description

Successful response

Key Type Description
status String Status of the request, ok in this case
data Object Validation information

Failed response

Key Type Description
status String Status of the request, error in this case
message String Brief message about what is wrong

Sample request


POST /en/api/v2/document/cff827fc-e70e-167c-4ae5-d388b1b5c264/validation.json HTTP/1.1
Host: app.marksign.local
Content-Type: application/json

{
  "access_token": "f4b79b72-7587-f417-41f8-2de5a7c87fae"
}

Sample response

Sample success response


{
  "status": "ok",
  "data": {
    "simpleReport": {
      "validationTime": 1644945539572,
      "firstTimestampId": null,
      "documentFilename": "XsZP49.pdf",
      "validSignaturesCount": 0,
      "signatureIdList": [],
      "timestampIdList": [],
      "firstSignatureId": null,
      "signaturesCount": 0,
      "jaxbModel": {
        "validationPolicy": {
          "policyName": "QES AdESQC TL based",
          "policyDescription": "Validate electronic signatures and indicates whether they are Advanced electronic Signatures (AdES), AdES supported by a Qualified Certificate (AdES/QC) or a\n\t\tQualified electronic Signature (QES). All certificates and their related chains supporting the signatures are validated against the EU Member State Trusted Lists (this includes\n\t\tsigner's certificate and certificates used to validate certificate validity status services - CRLs, OCSP, and time-stamps).\n\t"
        },
        "documentName": "XsZP49.pdf",
        "validSignaturesCount": 0,
        "signaturesCount": 0,
        "containerType": null,
        "signatureOrTimestamp": [],
        "semantic": [],
        "validationTime": 1644945539572
      }
    },
    "diagnosticData": {
      "DocumentName": "XsZP49.pdf",
      "ValidationDate": "2022-02-15T17:18:59",
      "Signatures": [],
      "UsedCertificates": [],
      "UsedRevocations": [],
      "UsedTimestamps": [],
      "OriginalDocuments": [],
      "TrustedLists": []
    }
  }
}

Sample failed response


{
  "status": "error",
  "message": "Document was not found"
}

Implementation

CURL


curl --location --request POST 'https://app.marksign.local/en/api/v2/document/cff827fc-e70e-167c-4ae5-d388b1b5c264/validation.json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "access_token": "f4b79b72-7587-f417-41f8-2de5a7c87fae"
}'

Using php-client

To use the php-client, please follow the installation and basic usage here, and use AppBundle\GatewaySDKPhp\RequestBuilder\DocumentValidationRequestBuilder as request builder.


/**
 * The document id that was found from "Document upload" request.
 * The following is a dummy to use as example.
 */
$documentId = 'c66cf14e-f763-9757-3b83-e5e28126a6df';

$validationReq = (new DocumentValidationRequestBuilder)
  ->withDocumentId($documentId)
  ->createRequest();
$validationRes = $client->postRequest($validationReq);
$validationResArray = $validationRes->toArray();
var_dump($validationResArray);