PATCH/{resource-id}

Edits parameters of the specified objects.

Request format

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

Parameter

Description

resource-id

ID of the resource where the objects are located.

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}"
      }
    },
    {
      ...
    }
  ]
}

Parameters of the request body

  • data [*](*Обязательный_параметр) Object with parameters.

    • ID [*](*Обязательный_параметр) Object ID.

    • type [*](*Обязательный_параметр) Resource type.

    • attributes [*](*Обязательный_параметр) Object parameters.

      Restriction.

      The allowed values depend on the resource that the object belongs to. They are listed in the editable_fields parameter for the GET/{resource-id}/{object-id} operation. As an example, some of the parameters are shown below.

      • actions Actions allowed for the current object.

      • brands Brands set for this object.

        • bid The minimum bid required for showing the brand (in rubles).

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

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

      • client_id Client ID.

      • email The client's email address.

      • excluded_domains Excluded domains.

      • excluded_phones Excluded phones.

      • geo Regional targeting set for this object.

        • id Region ID. Use the GET/{resource-id} operation to get the region.

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

      • lang Interface language.

      • lastname The client's last name.

      • level The nesting level.

      • login User login.

      • midname The user's middle name.

      • multistate The current status of the object.

      • multistate_name Text description of the object's status.

      • name Object name.

      • page_id Site ID.

      • parent_id ID of the parent object.

      • regularity Sorting order in the interface.

      • roles The user's roles.

      • status Object status. Acceptable values:

                 - **sync** — Synchronized.
        
                 - **pending** — Sending.
        

* Required parameter

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 Array with information for the specified object.

    • relationships Related resources and objects.

      • links References to objects related to the current object.

        • related Reference to a list of related objects with parameters.

        • self Reference to a list of related objects.

    • id Object ID.

    • type Resource type.

    • attributes [*](*Обязательный_параметр) Object parameters.

      Restriction.

      The allowed values depend on the resource that the object belongs to. They are listed in the editable_fields parameter for the GET/{resource-id}/{object-id} operation. As an example, some of the parameters are shown below.

      • actions Actions allowed for the current object.

      • brands Brands set for this object.

        • bid The minimum bid required for showing the brand (in rubles).

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

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

      • client_id Client ID.

      • email The client's email address.

      • excluded_domains Excluded domains.

      • excluded_phones Excluded phones.

      • geo Regional targeting set for this object.

        • id Region ID. Use the GET/{resource-id} operation to get the region.

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

      • lang Interface language.

      • lastname The client's last name.

      • level The nesting level.

      • login User login.

      • midname The user's middle name.

      • multistate The current status of the object.

      • multistate_name Text description of the object's status.

      • name Object name.

      • page_id Site ID.

      • parent_id ID of the parent object.

      • regularity Sorting order in the interface.

      • roles The user's roles.

      • status Object status. Acceptable values:

                 - **sync** — Synchronized.
        
                 - **pending** — Sending.
        
    • links Links associated with the object.

      • self Reference to the current object.

* Required parameter

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"
      }
    }
  ]
}