Errors only

Returned if the only_errors parameter is set to “true”.

If there are no errors in the validated document, the server returns the code “204 No Content”.

If errors were not found, the response has the standard structure, however:

  • Fields that do not contain nested objects or errors are not shown.
  • Fields with nested objects but no errors have the value “[{}]”.

Information about errors found is contained in the #error field.

"#error": [
                 {
                   "#message": "Text description of the error in the language set in the lang parameter",
                   "#location": "Location of the error in the source HTML code (line number containing the tag with the error)",
                   "#error_code": "Error code",
                   "#type": "Type of error: error, warning, or yandex (failure to comply with Yandex requirements)".
                }
            ]

Example

The example shows a POST request and response.

Request URL:

https://validator-api.semweb.yandex.ru/v1.1/document_parser?apikey=12345a12-3b4c-5123-d4ef-g51h23ij451&pretty=true&id=1a&lang=en&only_errors=true

Request body:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "LocalBusiness",
  "address": {
    "@type": "PostalAddress",
    "addressLocality": "Russia, Moscow",
    "streetAddress": "3 Profsoyuznaya ulitsa"
  },
  "name": "Company name"
}
</script>
<meta property="og:type" content="website" />
<meta property="og:url" content="http://www.example.com/" />
<meta property="og:site_name" content="Website name" />
<meta property="og:description" content="Website description"/>
<meta property="og:image" content="http://example.com/site.jpg" />
<meta property="og:image:width" content="300" />
<meta property="og:image:height" content="300" />
<div class="item" itemscope itemtype="http://schema.org/LocalBusiness">
    <h2><span itemprop='name'>Company name</span></h2>
    <div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress" 
            <span itemprop='postalCode'>111111</span>,
            <span itemprop='addressLocality'>Moscow, Russia</span>,
            <span itemprop='streetAddress'>3 Profsoyuznaya ulitsa</span>
    </div>
</div>

Response:

{
    "data": {
        "microdata": [{
            "http://schema.org/address": [{}],
            "#error": [{
                "#message": "WARNING:  Failed to meet the requirement for Yandex business search structured snippets: you must complete the <b>telephone</b> field for this type of organization",
                "#location": "20:71",
                "#error_code": "org_field_missing",
                "#type": "yandex"
            }]
        }],
        "rdfa": [{
            "http://ogp.me/ns#type": [{}],
            "http://ogp.me/ns#site_name": [{}],
            "#error": [{
                "#message": "ERROR:  The field <b>http://ogp.me/ns#title</b> is missing or empty",
                "#location": "-1:-1",
                "#error_code": "missing_empty",
                "#type": "error"
            }],
            "http://ogp.me/ns#description": [{}],
            "http://ogp.me/ns#image": [{
                "http://ogp.me/ns#image:height": [{}],
                "http://ogp.me/ns#image:width": [{}],
                "_:content": [{}]
            }],
            "http://ogp.me/ns#url": [{}]
        }],
        "microformat": [],
        "json-ld": [{
            "http://schema.org/name": [{}],
            "http://schema.org/address": [{
                "http://schema.org/addressLocality": [{}],
                "http://schema.org/streetAddress": [{}]
            }]
        }]
    },
    "id": "1a"
}