Standard
Returned if the only_errors
parameter is omitted or is set to “false”.
The response is generated in JSON format. It contains the following fields:
-
id — The request ID (more information).
-
data — Data extracted from micro markup: microformats, microdata, RDFa, and JSON-LD (more information).
{
"id": "...",
"data":{
"microformat": [{},{},..,{}],
"rdfa": [{},{},..,{}],
"microdata": [{},{},..,{}],
"json-ld": [{},{},..,{}]
}
}
JSON-LD keywords are marked with the @
symbol in the response (for example, @type
, @value
).
Function words are marked with the #
symbol (for example, #location
, #message
, #error_code
, #type
).
id
Value of the request ID (the id
parameter).
If the ID was omitted, the “null” value is returned.
"id":null
data
The values of fields extracted from micro markup: microformats, microdata, RDFa, and JSON-LD. Each of these fields is an array of objects.
The objects in the array correspond to the objects in the source HTML, and they usually have @type
(an array of strings containing information about types).
"@type": ["http://schema.org/PostalAddress"]
The objects contain fields extracted from micro markup, and information about errors (#error
).
"#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)".
}
]
Field values can be:
-
Arrays of objects that have their own type (
@type
).[{ "@type": ["http://schema.org/ListenAction"], "property1":{} }, { "@type": ["http://schema.org/ListenAction"], "property2":{} }],
-
Arrays of untyped objects (the type was not defined in the source code).
-
Arrays of objects in the form:
[{"@value": "Text"}]
. In the source code they are represented as text fields or arrays."http://ogp.me/ns#audio": [{"@value": "text", "#location": "2:13"}]
For each field that has a value (@value),
the position in the source HTML code is given (#location
) — the line number and column.
"#location": "18:47"
A link to the resource (@resource
) is returned if the document address is set in the URL parameter, or the resource
attribute is explicitly specified in the document's HTML code. For example: <span resource="http://www.kinopoisk.ru/film/607608/"></span>
.
"@resource":["http://www.kinopoisk.ru/film/607608/"]
Features of processing RDFa micro markup:
-
Extracted fields are grouped into objects according to the prefix of the vocabulary they belong to: Open Graph (og), Facebook (fb), AppLink (al).
-
Structured fields defined using the OpenGraph vocabulary are wrapped in a
_:content
service object in the response."http://ogp.me/ns#image": [{ "http://ogp.me/ns#image:height": [{ "#location": "19:48", "@value": "300" }], "http://ogp.me/ns#image:width": [{ "#location": "18:47", "@value": "300" }], "_:content": [{ "#location": "17:65", "@value": "http://example.com/site.jpg" }] }]
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
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/name": [{ "#location": "21:29", "@value": "Company name" }], "@type": ["http://schema.org/LocalBusiness"], "http://schema.org/address": [{ "http://schema.org/addressLocality": [{ "#location": "24:45", "@value": "Moscow, Russia" }], "@type": ["http://schema.org/PostalAddress"], "http://schema.org/postalCode": [{ "#location": "23:40", "@value": "111111" }], "http://schema.org/streetAddress": [{ "#location": "25:43", "@value": "3 Profsoyuznaya ulitsa" }] }], "#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": [{ "#location": "13:44", "@value": "website" }], "http://ogp.me/ns#site_name": [{ "#location": "15:56", "@value": "Website name" }], "@type": ["og"], "#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": [{ "#location": "16:57", "@value": "Website description" }], "http://ogp.me/ns#image": [{ "http://ogp.me/ns#image:height": [{ "#location": "19:48", "@value": "300" }], "http://ogp.me/ns#image:width": [{ "#location": "18:47", "@value": "300" }], "_:content": [{ "#location": "17:65", "@value": "http://example.com/site.jpg" }] }], "http://ogp.me/ns#url": [{ "#location": "14:59", "@value": "http://www.example.com/" }] }], "microformat": [], "json-ld": [{ "http://schema.org/name": [{ "#location": "10:12", "@value": "Company name" }], "@type": ["http://schema.org/LocalBusiness"], "http://schema.org/address": [{ "http://schema.org/addressLocality": [{ "#location": "7:25", "@value": "Moscow, Russia" }], "@type": ["http://schema.org/PostalAddress"], "http://schema.org/streetAddress": [{ "#location": "8:23", "@value": "3 Profsoyuznaya ulitsa" }] }] }] }, "id": "1a" }