Stay organized with collections
Save and categorize content based on your preferences.
Fetching references to proto classes when using the API requires that you either
have an intrinsic understanding of the API or need to frequently look up the
proto reference documentation for the exact path.
ProtoLookupUtil
The proto lookup util lets you look up and create instances of services,
operations, enumerations, and resources without having to keep track of API
version numbers and namespaces.
But with the proto lookup util, you can use a simpler form:
campaign=client.resource.campaign
When fetching a resource, service, or operation, an instance of that entity is
returned. When fetching an enumeration, a reference to the class is returned,
without instantiation.
For enumerations, you can use a shortcut to bypass the need for looking up the
enumeration protos.
campaign.status=:PAUSED
We recommend using the client.service method to fetch services even if you
don't use this utility for any other use cases. There is extra logic built into
this method to pass along your developer token and authentication details, which
you would have to handle manually if you used another method.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-03 UTC."],[[["\u003cp\u003eThe ProtoLookupUtil simplifies interactions with the Google Ads API by removing the need to specify API version numbers and namespaces when working with services, operations, enumerations, and resources.\u003c/p\u003e\n"],["\u003cp\u003eInstead of manually instantiating proto classes with complex paths, the utility allows you to create and access them using a more concise and intuitive syntax, such as \u003ccode\u003eclient.resource.campaign\u003c/code\u003e instead of \u003ccode\u003eGoogle::Ads::GoogleAds::V18::Resources::Campaign.new\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIt offers a shortcut for using enumerations directly, like assigning \u003ccode\u003e:PAUSED\u003c/code\u003e to a campaign status, without requiring explicit proto lookups.\u003c/p\u003e\n"],["\u003cp\u003eUsing \u003ccode\u003eclient.service\u003c/code\u003e is recommended for fetching services, as it automatically handles developer token and authentication details.\u003c/p\u003e\n"]]],[],null,["# Lookup Util\n\nFetching references to proto classes when using the API requires that you either\nhave an intrinsic understanding of the API or need to frequently look up the\nproto reference documentation for the exact path.\n\nProtoLookupUtil\n---------------\n\nThe proto lookup util lets you look up and create instances of services,\noperations, enumerations, and resources without having to keep track of API\nversion numbers and namespaces.\n\nHere's how you typically instantiate a campaign: \n\n campaign = Google::Ads::GoogleAds::V21::Resources::Campaign.new\n\nBut with the proto lookup util, you can use a simpler form: \n\n campaign = client.resource.campaign\n\nWhen fetching a resource, service, or operation, an instance of that entity is\nreturned. When fetching an enumeration, a reference to the class is returned,\nwithout instantiation.\n\nFor enumerations, you can use a shortcut to bypass the need for looking up the\nenumeration protos. \n\n campaign.status = :PAUSED\n\nWe recommend using the `client.service` method to fetch services even if you\ndon't use this utility for any other use cases. There is extra logic built into\nthis method to pass along your developer token and authentication details, which\nyou would have to handle manually if you used another method."]]