AI-generated Key Takeaways
-
Use
SearchAds360FieldServiceto dynamically retrieve metadata about resources, fields, segmentation keys, and metrics available in Search Ads 360 Reporting API. -
This metadata helps in validating and constructing Search Ads 360 Query Language statements for use with the
SearchandSearchStreammethods. -
Request the catalog for resources, resource fields, segmentation fields, and metrics using the specified URL structure.
-
Explore the catalog metadata including
attributeResources,metrics,segments, andselectableWithfor query construction. -
Utilize the
searchmethod ofSearchAds360FieldServiceto query for specific field details using regular expressions or specific field names.
You can use SearchAds360FieldService
to dynamically request the catalog for resources, resource's fields,
segmentation keys and metrics available in the SearchAds360Service
Search and SearchStream methods. The catalog provides metadata that can be
used by Search Ads 360 Reporting API clients for validation and construction of Search Ads 360
Query Language statements.
Sample HTTP request and response
The request consists of an HTTP GET to the Search Ads 360 Reporting API server at the
following URL:
https://searchads360.googleapis.com/v0/searchAds360Fields/{resource_or_field}
The following is an example of a request followed by the response returned from
SearchAds360FieldService for ad_group resource:
Request
https://searchads360.googleapis.com/v0/searchAds360Fields/ad_group
Response
{
"resourceName": "searchAds360Fields/ad_group",
"name": "ad_group",
"category": "RESOURCE",
"selectable": false,
"filterable": false,
"sortable": false,
"selectableWith": [
"campaign",
"customer",
"metrics.average_cpc",
"segments.device",
...
],
"attributeResources": [
"customer",
"campaign"
],
"metrics": [
"metrics.conversions",
"metrics.search_budget_lost_impression_share",
"metrics.average_cost",
"metrics.clicks",
...
],
"segments": [
"segments.date",
"segments.ad_network_type",
"segments.device",
...
]
}
For this example, the important arrays are:
attributeResources- Resources that can be implicitly joined to the resource in the
FROMclause. metrics- Metrics that are available to be selected with the resource in the
FROMclause. Only populated for fields where thecategoryisRESOURCE. segments- Segment keys that can be selected with the resource in the
FROMclause. These segment the metrics specified in the query. Only populated for fields where thecategoryisRESOURCE. selectableWith- Fields that can be selected alongside a given field, when not in the
FROMclause. This attribute is only relevant when identifying resources or segments that are able to be selected in a query where they are not included by the resource in theFROMclause. As an example, if you are selectingad_group.idandsegments.datefromad_group, and you want to include attributes fromcampaign, you would need to check thatsegments.dateis in theselectableWithattribute for campaign, since it's being selected alongside the existingsegments.datefield.
Metadata details
You can request the catalog using the SearchAds360FieldService at these
levels:
- Resource
- For example,
searchAds360Fields/campaign. - Resource's field
- For example,
searchAds360Fields/campaign.name. - Segmentation field
- For example,
searchAds360Fields/segments.ad_network_type. - Metric
- For example,
searchAds360Fields/metrics.clicks.
Use a query to get field details
It is possible to get field details by sending a query to
https://searchads360.googleapis.com/v0/searchAds360Fields:search
Example 1: Using a regular expression.
SELECT
name,
category,
selectable,
filterable,
sortable,
selectable_with,
data_type,
is_repeated
WHERE name LIKE 'ad_group.%'"
Example 2: Querying specific fields, metrics or segments.
SELECT
name,
category,
selectable,
filterable,
sortable,
selectable_with,
data_type,
is_repeated
WHERE
name IN (
"ad_group.id",
"ad_group.name",
"segments.date",
"customer.id",
"customer.manager",
"metrics.clicks"
)