GET/resources

Returns a list of available resources.

Request format

GET https://jsonapi.partner2.yandex.com/vX/resources
  ? [fields[resources]=<string>]

Parameter

Description

fields[resources]

Outputs the parameters available for an array of resources. Acceptable values:

  • available_fields — The array of parameters available for the resource.

  • title — The name of the resource.

  • available_actions — Array of actions available for the resource.

  • methods — Array of methods available for the resource.

To add multiple values 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

{
  "data": [
    {
      "type": "{string}",
      "id": "{string}",
      "attributes": {
        "available_actions": [
          "{string}",
          "{string}"
        ],
        "methods": [
          "{string}",
          "{string}"
        ],
        "available_fields": [
          "actions",
          "brands",
          "client_id",
          "email",
          "excluded_domains",
          "excluded_phones",
          "geo",
          "lang",
          "lastname",
          "level",
          "login",
          "midname",
          "multistate",
          "multistate_name"
          "name",
          "page_id",
          "parent_id",
          "regularity",
          "roles",
          "status",
          ...
        ],
        "title": "{string}"
      },
      "meta": {
        "show_in_menu": {boolean}
      },
      "links": {
        "self": "{string}"
      }
    },
    ...
  ],
  "links": {
    "self": "{string}"
  },
  "meta": {
    "count": {integer},
    "fields": [
      "{string}",
      "{string}"
    ]
  }
}

Response parameters

  • data Array of available resources.

    • type Date type (in this case, the resource).

    • id Resource ID.

    • attributes Object containing the parameters available for the resource.

      • available_actions Array of actions available for the resource.

      • methods Array of methods available for the resource. Used in the interface.

      • available_fields Array of parameters available for the resource. The list of parameters depends on the resource. As an example, some of the parameters are shown below.

        • actions Actions available for this object.

        • brands Brands set for this object.

        • 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 phone numbers.

        • geo Regional targeting set for this object.

        • lang Interface language.

        • lastname The client's last name.

        • level The nesting level.

        • login The user's username.

        • 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 The status of the object.

      • title The name of the resource.

    • meta This object contains internal parameters.

      • show_in_menu Whether the resource is shown in the menu in the interface.
    • links Links associated with the resource.

      • self Reference to the resource.
  • links Links associated with the resource.

    • self Reference to the request.
  • meta This object contains meta information.

    • count The total number of resources.

    • fields The array of requested parameters.

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/resources?fields[resources]=available_fields,title,available_actions,methods'

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: 3761
Connection: keep-alive

{
  "data": [
    {
      "type": "resources",
      "id": "resources",
      "attributes": {
        "available_actions": [],
        "methods": [
          "GET"
        ],
        "available_fields": [
          "title",
          "available_fields",
          "available_actions",
          "methods"
        ],
        "title": "Resources"
      },
      "meta": {
        "show_in_menu": false
      },
      "links": {
        "self": "https://jsonapi.partner2...v1/resources/resources"
      }
    },
    {
      "type": "resources",
      "id": "context_on_site_rtb",
      "attributes": {
        "available_actions": [
          "duplicate"
        ],
        "methods": [
          "GET",
          "POST"
        ],
        "available_fields": [
          "brands",
          "multistate",
          "multistate_name",
          "actions",
          "editable_fields",
          "geo",
          "status"
        ],
        "title": "RTB units"
      },
      "meta": {
        "show_in_menu": true
      },
      "links": {
        "self": "https://jsonapi.partner2...v1/resources/context_on_site_rtb"
      }
    },
    ...
    {
      "type": "resources",
      "id": "search_on_site_campaign",
      "attributes": {
        "available_actions": [],
        "methods": [
          "GET",
          "POST"
        ],
        "available_fields": [
          "excluded_domains",
          "excluded_phones",
          "multistate",
          "multistate_name",
          "editable_fields",
          "status"
        ],
        "title": "Search sites"
      },
      "meta": {
        "show_in_menu": true
      },
      "links": {
        "self": "https://jsonapi.partner2...v1/resources/search_on_site_campaign"
      }
    },
    {
      "type": "resources",
      "id": "context_on_site_campaign",
      "attributes": {
        "available_actions": [],
        "methods": [
          "GET",
          "POST"
        ],
        "available_fields": [
          "page_id",
          "excluded_domains",
          "excluded_phones",
          "multistate",
          "multistate_name",
          "editable_fields",
          "status"
        ],
        "title": "Content sites"
      },
      "meta": {
        "show_in_menu": true
      },
      "links": {
        "self": "https://jsonapi.partner2...v1/resources/context_on_site_campaign"
      }
    }
  ],
  "links": {
  "self": "https://jsonapi.partner2...v1/resources?fields%5Bresources%5D=available_fields,title,available_actions,methods..."
  },
  "meta": {
    "count": 13,
    "fields": [
      "available_fields",
      "title",
      "available_actions",
      "methods"
    ]
  }
}