Adding a sitemap file

Description

Adds a sitemap file to Yandex.Webmaster.

Request format

Send a POST request to the operation address for the user-added-sitemaps resource for the user's site. In the request body, pass the URL of the file 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}/user-added-sitemaps/
Content-type: application/xml

Path parameters

Name Required Type Default value Description
user-id Yes int64 The user ID.
host-id Yes host id Site ID.

Example

{
  "url": "http://example.com"
}
Parameter Description
url URL of the sitemap file to add.

Response format

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

Samples

{
  "sitemap_id": "c7-fe:80-c0"
}
Name Required Type Description
sitemap_id Yes string ID of the added sitemap.

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."
}
Parameter Description
error_code Error code.
available_user_id ID of the user who allowed access.
error_message Error 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_FOUND",
  "host_id": "http:ya.ru:80",
  "error_message": "explicit error message"
}
Parameter Description
error_code Error code.
host_id The ID of the requested site.
error_message Error message.

409 Conflict

The sitemap file that was passed was already added earlier.

{
  "error_code": "SITEMAP_ALREADY_ADDED",
  "error_message": "explicit error message"
}
Parameter Description
error_code Error code.
error_message Error message.