GET/{resource-id1}/{object-id}/{resource-id2}

Returns objects (with parameters) that are related to the specified object.

Request format

GET https://jsonapi.partner2.yandex.com/vX
  ? [fields[{resource-id2}]=<string>]
  & [page[size]=<integer>]
  & [page[number]=<integer>]
  & [filter=<string>]

Parameter

Description

resource-id1

ID of the first resource.

object-id

ID of an object that belongs to the first resource.

resource-id2

ID of the second resource. The list of objects for the second resource is searched for objects that are related to the specified object.

fields[{resource-id2}]

Parameters that are available for objects. Acceptable values:

  • actions — Actions allowed for the current object.

  • block_type — Ad unit type.

  • brands — Brands set for this object.

  • client_id — Client ID.

  • dsp_blocks — Size of display ad unit. For interstitial and rewarded units, you can leave this field empty.

  • editable_fields — Parameters of the current object that can be edited.

  • email — The client's email address.

  • excluded_domains — Excluded domains.

  • excluded_phones — Excluded phones.

  • formats_setup_mode — Format settings. Acceptable values:

    • standard — Unit formats are configured automatically using default parameters.

    • manual — Unit formats are configured in the design_templates parameter.

  • geo — Regional targeting set for this object.

  • 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 — Name of the object.

  • page_id — Site ID.

  • parent_id — ID of the parent object.

  • regularity — Sorting order in the interface.

  • roles — The user's roles.

  • status — Status of the object. Acceptable values:

    • sync — Synchronized.

    • pending — Sending.

  • tech_type — Field for working with units for Turbo and AMP pages. Only applicable for "block_type" : "banner". Acceptable values:

    • turbo — Turbo unit.

    • amp — AMP unit.

Restriction.

The allowed values depend on the resource. They are listed in the available_fields parameter for the GET/resources operation.

To add multiple values to the request, separate them with commas.

page[size]

The number of resource objects to include in the response. Default value: 100. The maximum value is 1000.

page[number]

The page number to begin the output from.

filter

Filter. The allowed filter values are listed in the filters parameter for the GET/{resource-id} operation. For more information about filters, see Filtering data.

Restriction.

Filters are not available for all resources.

notitle

ID of the related resource. The response contains additional information about the related resource.

Note

To add multiple resources to the request, separate them with commas.

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

{
  "included":
  [
    {
      "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}"
      }
    }
  ],
  "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}"
      }
    }
  ],
  "links": {
    "first": "{string}",
    "next": "{string}",
    "prev": "{string}",
    "self": "{string}",
    "last": "{string}"
  },
  "meta": {
    "found_rows": {integer},
    "count": {integer},
    "fields": [
      "{string}",
      "{string}"
    ],
    "filters": 
    [
      {
        "name": "{string}",
        "values":
        [
          {
            "label": "{string}",
            "id": "{string}"
          },
          {
            ...
          }
        ],
        "label": "{string}",
        "type": "{string}"
      }
    ]
  }
}

Response parameters

  • included Array of objects of the specified related resource.

    • 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 Array of object parameters. The list of parameters depends on the resource type. 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).

      • client_id Client ID.

      • editable_fields Parameters of the current object that can be edited.

      • 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.
  • data Array of objects of the specified resource.

    • 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 Array of object parameters. The list of parameters depends on the resource type. 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).

      • client_id Client ID.

      • editable_fields Parameters of the current object that can be edited.

      • 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.
  • links Links by page.

    • first Link to the first page.

    • next Link to the next page.

    • prev Link to the previous page.

    • self Link to the current page.

    • last Link to the last page.

  • meta This object contains meta information.

    • found_rows Total number of objects.

    • count The number of objects in the response.

    • fields The array of requested parameters.

    • filters Filters that can be applied to objects of the specified resource. For more information about filters, see Filtering data.

      • name Parameter name.

      • values Allowed parameter values. Used for building the filter.

        • label Name of the parameter in the interface.

        • ID of the filter value.

      • label Name of the parameter in the interface.

      • type Parameter type. Helps identify which operators can be used for building the filter.

Example for JSON

Request:

curl -i -g -H "Accept: application/vnd.api+json" -H "Authorization: token 66..." -X GET "https://jsonapi.partner2.yandex.com/v1/context_on_site_rtb/R-A-3228-1/context_on_site_campaign?fields[context_on_site_campaign]=multistate,multistate_name,editable_fields,status&page[size]=2&page[number]=1"

Response:

HTTP/1.1 200 OK
Server: nginx/1.8.1
Date: Sun, 18 Dec 2016 12:39:50 GMT
Content-Type: application/vnd.api+json
Content-Length: 2973
Connection: keep-alive{
  "data": [{
      "relationships":{
        "context_on_site_adblock":{
          "links":{
            "related": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/882/context_on_site_adblock",
            "self": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/882/relationships/context_on_site_adblock"
          }
        },
        "blocks":{
          "links":{
            "related": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/882/blocks",
            "self": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/882/relationships/blocks"
          }
        },
        "context_on_site_adfox":{
          "links":{
            "related": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/882/context_on_site_adfox",
            "self": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/882/relationships/context_on_site_adfox"
          }
        },
        "context_on_site_rtb":{
          "links":{
            "related": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/882/context_on_site_rtb",
            "self": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/882/relationships/context_on_site_rtb"
          }
        }
      },
      "id": "882",
      "type": "context_on_site_campaign",
      "attributes":{
        "status": "sync",
        "multistate_name": "Active.\nAdded to Yandex Balance.",
        "multistate": 17,
        "editable_fields":{
          "excluded_domains": true,
          "excluded_phones": true
        }
      },
      "links":{
        "self": "https://jsonapi.partner2.yandex.com/v1/context_on_site_campaign/882"
      }
    }
  ],
  "links":{
    "first": "https://jsonapi.partner2.yandex.com/v1/context_on_site_rtb/R-A-3228-1/context_on_site_campaign?apikey=66...&fields%5Bcontext_on_site_campaign%5D=multistate,multistate_name,editable_fields,status&page%5Bsize%5D=2&page%5Bnumber%5D=1",
    "next": null,
    "prev": null,
    "self": "https://jsonapi.partner2.yandex.com/v1/context_on_site_rtb/R-A-3228-1/context_on_site_campaign?apikey=6...&fields%5Bcontext_on_site_campaign%5D=multistate,multistate_name,editable_fields,status&page%5Bsize%5D=2&page%5Bnumber%5D=1",
    "last": "https://jsonapi.partner2.yandex.com/v1/context_on_site_rtb/R-A-3228-1/context_on_site_campaign?apikey=66...&fields%5Bcontext_on_site_campaign%5D=multistate,multistate_name,editable_fields,status&page%5Bsize%5D=2&page%5Bnumber%5D=1"
  },
  "meta":{
    "found_rows": 1,
    "count": 1,
    "fields":
    [
      "editable_fields",
      "multistate",
      "multistate_name",
      "status"
    ],
    "filters":
    [{
        "name": "page_id",
        "type": "number",
        "label": "Page ID"
      },{
        "name": "multistate",
        "values":
        [{
            "label": "Blocked",
            "id": "blocked"
          },{
            "label": "Needs approval",
            "id": "need_approve"
          },{
            "label": "Saving changes",
            "id": "need_update"
          },{
            "label": "Locked for editing",
            "id": "protected"
          },{
            "label": "Rejected by moderators",
            "id": "rejected"
          },{
            "label": "Stopped",
            "id": "stopped"
          },{
            "label": "Testing",
            "id": "testing"
          },{
            "label": "Updating",
            "id": "updating"
          },{
            "label": "Active",
            "id": "working"
          }
        ],
        "type": "multistate",
        "label": "Status"
      }
    ]
  }
}