PATCH/{resource-id}

Edits the parameters of the specified objects.

Request format

PATCH https://jsonapi.partner2.yandex.com/vX/{resource-id}

Parameter

Description

resource-id

The ID of the resource hosting the objects.

The format of the request body

JSON

{
  "data": [
    {
      "type": "{string}",
      "id": "{string}",
      "attributes": {
        "actions": {...},
        "brands": [
          {
            "bid": "{string}",
            "blocked": {boolean},
            "cpm": {integer}
          },
          {
            ...
          }
        ],
        "client_id": {integer},
        "email": "{string}",
        "excluded_domains": ["{string}"],
        "excluded_phones": ["{string}"],
        "geo": [
          {
            "id": "{string}",
            "cpm": {integer}
          },
          {
            ...
          }
        ],
        "lang": "{string}",
        "lastname": "{string}",
        "level": {integer},
        "login": "{string}",
        "midname": "{string}",
        "multistate": {integer},
        "multistate_name": "{string}",
        "name": "{string}",
        "page_id": {integer},
        "parent_id": {integer},
        "regularity": {integer},
        "roles": "{string}",
        "status": "{string}"
      }
    },
    {
      ...
    }
  ]
}

The parameters of the request body

  • data * An object with the parameters.

    • id * The object ID.

    • type * The resource type.

    • attributes * The object's parameters to change.

      Restriction.

      The acceptable values depend on the resource hosting the object and are listed in the editable_fields parameter of the GET/{resource-id}/{object-id} operation. Some of the parameters are listed below as an example.

      • actions Acceptable actions for the current object.

      • brands Brands that were set for the current object.

        • bid The minimum bid (in rubles) required for a brand impression.

        • blocked The brand is blocked (true or false).

        • cpm The minimum CPM (in rubles) required for a brand impression.

      • client_id Client ID.

      • email The client's email address.

      • excluded_domains The excluded domains.

      • excluded_phones The excluded phone numbers.

      • geo The regional targetings set for the current object.

        • id ID of the region. To get the region, use the GET/{resource-id} operation.

        • cpm The minimum CPM (in rubles) required for impressions in the current region.

      • lang The language of the interface.

      • lastname The client's last name.

      • level The level of nesting.

      • login Username.

      • midname The user's middle name.

      • multistate The current status of the object.

      • multistate_name Text description of the object status.

      • name The name of the object.

      • page_id The ad platform ID.

      • parent_id The ID of the parent object.

      • regularity The sorting order used in the interface.

      • roles The user's roles.

      • status The status of the object. Acceptable values:

                   - sync: Synchronized.

                   - pending: In the process of being sent.

* Required

The general structure of the response is given below. The elements may appear in a different order. The structure may contain internal parameters that are not described in the table.

Response format

JSON

{
  "data": [
    {
      "relationships": {
        "{string}": {
          "links": {
            "related": "{string}",
            "self": "{string}"
          }
        },
        ...
      },
      "id": "{string}",
      "type": "{string}",
      "attributes": {
        "actions": {...},
        "brands": [
          {
            "bid": "{string}",
            "blocked": {boolean},
            "cpm": {integer}
          },
          {
            ...
          }
        ],
        "client_id": {integer},
        "email": "{string}",
        "excluded_domains": ["{string}"],
        "excluded_phones": ["{string}"],
        "geo": [
          {
            "id": "{string}",
            "cpm": {integer}
          },
          {
            ...
          }
        ],
        "lang": "{string}",
        "lastname": "{string}",
        "level": {integer},
        "login": "{string}",
        "midname": "{string}",
        "multistate": {integer},
        "multistate_name": "{string}",
        "name": "{string}",
        "page_id": {integer},
        "parent_id": {integer},
        "regularity": {integer},
        "roles": "{string}",
        "status": "{string}"
      },
      "links": {
        "self": "{string}"
      }
    },
    {
     ...
    }
  ]
}       

Response parameters

  • data An array with information about the objects hosted by the specified resource.

    • relationships The linked resources and objects.

      • links URLs of objects linked to the current object.

        • related The URL of a list of linked objects with parameters.

        • self The URL of a list of linked objects.

    • id The object ID.

    • type The resource type.

    • attributes * The object's parameters to change.

      Restriction.

      The acceptable values depend on the resource hosting the object and are listed in the editable_fields parameter of the GET/{resource-id}/{object-id} operation. Some of the parameters are listed below as an example.

      • actions Acceptable actions for the current object.

      • brands Brands that were set for the current object.

        • bid The minimum bid (in rubles) required for a brand impression.

        • blocked The brand is blocked (true or false).

        • cpm The minimum CPM (in rubles) required for a brand impression.

      • client_id Client ID.

      • email The client's email address.

      • excluded_domains The excluded domains.

      • excluded_phones The excluded phone numbers.

      • geo The regional targetings set for the current object.

        • id ID of the region. To get the region, use the GET/{resource-id} operation.

        • cpm The minimum CPM (in rubles) required for impressions in the current region.

      • lang The language of the interface.

      • lastname The client's last name.

      • level The level of nesting.

      • login Username.

      • midname The user's middle name.

      • multistate The current status of the object.

      • multistate_name Text description of the object status.

      • name The name of the object.

      • page_id The ad platform ID.

      • parent_id The ID of the parent object.

      • regularity The sorting order used in the interface.

      • roles The user's roles.

      • status The status of the object. Acceptable values:

                   - sync: Synchronized.

                   - pending: In the process of being sent.

    • links URLs linked to the object.

      • self The URL of the current object.

* Required

Example for JSON

Request:

curl -i -g -H "Accept: application/vnd.api+json" -H "Content-Type: application/vnd.api+json" -H "Authorization: token 66..." -X PATCH 'https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign' -d '{"data":[{"type":"context_on_site_campaign","id":"12","attributes":{"excluded_domains":["test-domain1.ru","test-domain2.ru"]}},{"type":"content_on_site_campaign","id":"3","attributes":{"excluded_domains":["test-domain3.ru","test-domain4.ru"]}}]}'

Response:

HTTP/1.1 200 OK
Server: nginx/1.8.1
Date: Tue, 17 Jan 2017 13:18:05 GMT
Content-Type: application/vnd.api+json
Content-Length: 2652
Connection: keep-alive
        
{
  "data": [
    {
      "relationships": {
        "context_on_site_adblock": {
          "links": {
            "related": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/12/context_on_site_adblock",
            "self": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/12/relationships/context_on_site_adblock"
          }
        },
        "blocks": {
          "links": {
            "related": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/12/blocks",
            "self": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/12/relationships/blocks"
          }
        },
        "context_on_site_adfox": {
          "links": {
            "related": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/12/context_on_site_adfox",
            "self": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/12/relationships/context_on_site_adfox"
          }
        },
        "context_on_site_rtb": {
          "links": {
            "related": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/12/context_on_site_rtb",
            "self": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/12/relationships/context_on_site_rtb"
          }
        }
      },
      "id": "12",
      "type": "context_on_site_campaign",
      "attributes": {
        "excluded_domains": ["test-domain1.ru","test-domain2.ru"]
      },
      "links": {
        "self": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/12"
      }
    },
    {
      "relationships": {
        "context_on_site_adblock": {
          "links": {
            "related": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/3/context_on_site_adblock",
            "self": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/3/relationships/context_on_site_adblock"
          }
        },
        "blocks": {
          "links": {
            "related": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/3/blocks",
            "self": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/3/relationships/blocks"
          }
        },
        "context_on_site_adfox": {
          "links": {
            "related": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/3/context_on_site_adfox",
            "self": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/3/relationships/context_on_site_adfox"
          }
        },
        "context_on_site_rtb": {
          "links": {
            "related": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/3/context_on_site_rtb",
            "self": "https://jjsonapi.partner2.yandex.com/v1/context_on_site_campaign/3/relationships/context_on_site_rtb"
          }
        }
      },
      "id": "3",
      "type": "context_on_site_campaign",
      "source-attributes": {
        "excluded_domains": ["test-domain3.ru","test-domain4.ru"]
      },
      "links": {
        "self": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/3"
      }
    }
  ]
}