Adding an original text

Description

Adds an original text from a site to Yandex.Webmaster.

Restriction.

No more than 100 texts per day may be added, and the text size must be from 500 to 32,000 characters.

Request format

Send a POST request to the operation address for the original-texts resource for the user's site. In the request body, pass the original text and specify the desired data type in the Content-type header (application/json or application/xml):

POST https://api.webmaster.yandex.net/v3/user/{user-id}/hosts/{host-id}/original-texts/
Content-type: application/xml

Path parameters

NameRequiredTypeDefault valueDescription
user-idYesint64The user ID.
host-idYeshost idSite ID.

Example

{
  "content": "some text"
}
ParameterDescription
contentThe original text.

Response format

If the site was added successfully, the server returns 201 Created.

Example

{
  "text_id": "some text",
  "quota_remainder": 1
}
NameRequiredTypeDescription
text_idYesstringID of the added original text.
quota_remainderYesint32The remainder of the daily quota for the number of added texts.

Errors

403 Forbidden

The user ID for the token doesn't match the one specified in the request. In the examples below, {user_id} is the correct uid for the owner of the OAuth token.

{
  "error_code": "INVALID_USER_ID",
  "available_user_id": 1,
  "error_message": "Invalid user id. {user_id} should be used."
}
ParameterDescription
error_codeError code.
available_user_idID of the user who allowed access.
error_messageError message.

404 Not Found

The site isn't in the list of the user's sites, or rights to the site haven't been verified.

{
  "error_code": "HOST_NOT_VERIFIED",
  "host_id": "http:ya.ru:80",
  "error_message": "explicit error message"
}
ParameterDescription
error_codeError code.
host_idThe ID of the requested site.
error_messageError message.

409 Conflict

The passed text was already added earlier.

{
  "error_code": "TEXT_ALREADY_ADDED",
  "error_message": "explicit error message"
}
ParameterDescription
error_codeError code.
error_messageError message.

422 Unprocessable Entity

The passed text is too short or too long.

{
  "error_code": "TEXT_LENGTH_CONSTRAINTS_VIOLATION",
  "max_length": 1,
  "min_length": 1,
  "actual_length": 1,
  "error_message": "explicit error message"
}
ParameterDescription
error_codeError code.
max_lengthError code.
min_lengthError code.
error_messageError message.

429 Too Many Requests

Exceeded the quota for adding original texts.

{
  "error_code": "QUOTA_EXCEEDED",
  "error_message": "explicit error message"
}
ParameterDescription
error_codeError code.
error_messageError message.