PATCH/{resource-id}/{object-id}

Edits parameters of the specified object.

Request format

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

Parameter

Description

resource-id

ID of the resource where the object is located.

object-id

ID of the object that you are changing parameters for.

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}"
    }
  },
  "meta": {
    "fields": ["{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.
        
  • meta This object contains meta information.

    • fields Changed object parameters.
  • 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/12' -d '{"data":{"type":"context_on_site_campaign","id":"12","attributes":{"excluded_domains":["test-domain1.ru","test-domain2.ru"]}}}'

Response:

HTTP/1.1 200 OK
Server: nginx/1.8.1
Date: Tue, 17 Jan 2017 09:13:07 GMT
Content-Type: application/vnd.api+json
Content-Length: 1373
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"]
    }
  },
  "meta":{
    "fields": ["excluded_domains"]
  },
  "links":{
    "self": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/12"
  }
}