Using temporary IDs - Ads API - Google Developers

文章推薦指數: 80 %
投票人數:10人

In the example below, the ad group operation would have to appear after the campaign operation in the list of operations. Temporary resource names are not ... Google AdsAPI Language English BahasaIndonesia Deutsch Español Français Português–Brasil Русский 中文–简体 日本語 한국어 Signin Guides Migration Reference Reports Libraries&Examples RESTInterface Support&Policies Google AdsAPI Guides Migration Reference Reports Libraries&Examples RESTInterface Support&Policies Productoverview QuickstartOverviewDevelopertokenClientlibraryOAuthcloudprojectOAuthclientlibraryRefreshtokenFirstcall BasicconceptsOverviewAPIstructureEntityrelationshipsVersioningChangingandinspectingobjectsRetrievingobjectsResourcemetadataCallstructure MutatesOverviewResourcemutatesBulkmutatesBestpractices AccountmanagementOverviewCreatinganaccountLinkingtomanageraccountsListaccessibleaccountsGetaccounthierarchyManaginguseraccessManaginguseraccessinvitationsChangeStatusserviceChangeEventservice AdmanagementOverviewAdtypesCreateadsMutateadsExpandedtextadsExpandedtextadcustomizationResponsivesearchadcustomization UpgradedURLsOverviewFieldsCodeexampleSupportedentitiesValuetrackparametersforUpgradedURLsReportsServingURLexpansionrules DynamicSearchAdsOverviewCreateDynamicSearchAdsDSApagefeedsReporting HotelAdsOverviewCreatecampaignCreateadgroupCreateadCreatelistinggroups BiddingOverviewAssignstrategySetbidsAdjustbidsReportingCreateBookonGooglecampaign ResponsivedisplayadsOverviewCreateadsRetrieveads ResponsivesearchadsOverviewCreateadsRetrieveads ShoppingAdsOverviewLinkMerchantCenterCreatecampaignCreateadgroupCreateadCreatelistinggroupsReporting AssetsOverviewWorkingwithassetsFetchingassetattributesandmetrics AuthenticationOverviewCloudprojectClientlibraryServiceaccountsInternals2-stepverificationPlayground BillingOverviewBillingsetupAccountbudgetInvoice CampaignmanagementOverviewCreatecampaignsCreateadgroups BudgetsOverviewCreatebudgetSharebudgetAssignbudgetRemovebudgetTrackperformanceRestrictions&errors BiddingOverviewStrategytypesPortfolioandstandardbiddingstrategiesCross-accountbiddingstrategiesAdgroupleveltargetoverridesSetbidsmanuallyManagebidmodifiersCreateseasonalityadjustmentsCreatedataexclusions AppcampaignsOverviewCreatecampaignCreateadgroup&adCodeexampleReporting ExperimentsOverviewCampaigndraftsCampaignexperimentsReportingonexperimentsAsyncerrors LocalcampaignsOverviewCreatecampaignCreateadgroupCreateadReporting PerformanceMaxcampaignsOverviewAssetsCreatecampaignAssetgroupsCreatecampaigncriteriaRetailReporting&troubleshooting SmartdisplaycampaignsOverviewCreatecampaignCreateadgroupCreateadReporting SmartcampaignsOverviewGetsuggestionsCreatebudgetCreatecampaignandcampaignsettingCreatecampaigncriteriaCreateadgroupandadgroupadSendmutaterequestReportingRecommendations ConversionmanagementOverviewCreateconversionactionsAdditionalconversionactiontypesUploadclickconversionsUploadwithformdataUploadcallconversionsUploadconversionadjustmentsEnhancedconversionsUploadstoresalesconversionsCustomconversionvariablesConversionvaluerulesMappingtoUImetrics ConversiongoalsOverviewCustomergoalsCampaigngoals ExtensionsandfeedsOverviewExtensiontypes Asset-basedextensionsOverviewMigratingFeed-basedExtensions ExtensionsettingservicesOverviewAddingextensionsUpdatingextensionsRemovingextensionsTargeting FeedservicesOverviewFeedsFeeditemsFeedmappingAssociatefeedsMatchingfunctionsFeeditemtargeting LocationextensionsOverviewGoogleadslocationextensionsAffiliatelocationextensionsFeeditemsetsFilteringlocationextensions PlanningserviceOverviewGeneratekeywordideasGeneratehistoricalmetricsGenerateforecastmetrics BidsimulationsOverviewPrerequisitesRetrievebidsimulations ReachforecastingOverviewConceptsAuthenticateSpecifyamediaplanGenerateacurve Remarketing&audiencetargetingOverview AudiencetypesVisitorstoyourwebsiteVisitorstospecificpagesVisitorswhotookspecificactionsMultipleuserlistsSimilaraudiencesCustomermatchAdditionaluserlistoptionsCustomaudiencesTargetingsettingsforremarketingAudienceperformanceRule-baseduserlists SamplescenarioOverviewCreatingtheruleitemgroupsCreatingtheuserlistCodeexamples DynamicRemarketingOverviewPrerequisitesAsset-basedDynamicRemarketingMigratetoasset-basedFeed-basedDynamicRemarketingRealestatefeedexampleFlightsfeedexampleMerchantcenter-basedDynamicRemarketingReportingFurtherinformation ReportingOverviewExampleCriteriametricsSegmentationZeroimpressionsLabelsStreamingPagingReportsintheUIMappingvaluetrackparameterswithreportfields QuerylanguageOverviewQuerygrammarQuerystructureDaterangesCasesensitivityOrderingandlimitingresultsInteractivequerybuilderQueryValidatorQueryCookbook TargetingOverviewCriteriaBidmodifiersLocationtargeting Operations BatchprocessingOverviewUsageflowUsingtemporaryIDsBestpractices&limitations BestpracticesOverviewMonitoringAPIlimitsandquotasSystemlimitsRatelimitsTroubleshootingErrortypesCommonerrorsPartialfailuresWarningsDevelopertokenreset PolicyexemptionrequestOverviewAdsKeywords ShareyourfeedbackabouttheGoogleAds(AdWords)API.Takethe2021AdWordsAPIandGoogleAdsAPIAnnualSurvey. Home Products GoogleAdsAPI Sendfeedback UsingtemporaryIDs ApowerfulfeatureofBatchJobServiceisthatit supportstheuseoftemporaryIDs. Youcandothisbyspecifyingthenewresource'sresource_nametousea negativeID.Forexample,ifyoucreateacampaignandspecifyitsresourcename ascustomers//campaigns/-1,thenwhenyouarecreatingthe adgroupinalateroperation,youcanreferenceitbythatresourcenameand the-1youspecifiedwillbereplacedbytheactualIDofthecreatedcampaign automatically. Herearesomethingstokeepinmindwhenusingtemporaryresourcenames: Atemporaryresourcenamecanonlybeusedafterit'sbeendefinedina resource.Intheexamplebelow,theadgroupoperationwouldhavetoappear afterthecampaignoperationinthelistofoperations. Temporaryresourcenamesarenotrememberedacrossjobsormutaterequests; toreferencearesourcecreatedinapreviousjobormutaterequest,useits actualresourcename. Forasinglejobormutaterequest,eachtemporaryresourcenamemustusea uniquenegativenumber,eveniftheyarefromdifferentresourcetypes.If atemporaryIDisreusedinasinglejobormutaterequest,thenanerror isreturned. Example Togiveamoreconcreteexampletothesituationmentionedabove,supposeyou wanttoaddacampaign,anadgroup,andanadinasingleAPIrequest.You wouldcreateastructureforyourrequestanalogoustothefollowing: mutate_operations:[ { campaign_operation:{ create:{ resource_name:"customers//campaigns/-1", ... } } }, { ad_group_operation:{ create:{ resource_name:"customers//adGroups/-2", campaign:"customers//campaigns/-1" ... } } }, { ad_group_ad_operation:{ create:{ ad_group:"customers//adGroups/-2" ... } } }, ] NoticethatanewtemporaryIDisusedfortheadgroup,sincewecan'treuse the-1thatweusedforthecampaign,andwealsoreferencethisadgroupwhen creatinganadgroupad.Theadgroupitselfreferencestheresourcenamewe establishedforthecampaigninanearlieroperationintherequest,while resource_nameinad_group_ad_operationisnotnecessarysincenofurther operationisreferencingit. Previous arrow_back Usageflow Next Bestpractices&limitations arrow_forward Sendfeedback Exceptasotherwisenoted,thecontentofthispageislicensedundertheCreativeCommonsAttribution4.0License,andcodesamplesarelicensedundertheApache2.0License.Fordetails,seetheGoogleDevelopersSitePolicies.JavaisaregisteredtrademarkofOracleand/oritsaffiliates. Lastupdated2021-11-05UTC. [{ "type":"thumb-down", "id":"missingTheInformationINeed", "label":"MissingtheinformationIneed" },{ "type":"thumb-down", "id":"tooComplicatedTooManySteps", "label":"Toocomplicated/toomanysteps" },{ "type":"thumb-down", "id":"outOfDate", "label":"Outofdate" },{ "type":"thumb-down", "id":"samplesCodeIssue", "label":"Samples/codeissue" },{ "type":"thumb-down", "id":"otherDown", "label":"Other" }] [{ "type":"thumb-up", "id":"easyToUnderstand", "label":"Easytounderstand" },{ "type":"thumb-up", "id":"solvedMyProblem", "label":"Solvedmyproblem" },{ "type":"thumb-up", "id":"otherUp", "label":"Other" }] Needtotellusmore? Blog Subscribetoourfeedforimportantannouncements. Forum Interactwithourcommunityofdeveloperexperts. ClientLibraries Useourofficiallysupportedclientlibraries. YouTube Accessourvideocontents. Android Chrome Firebase GoogleCloudPlatform Allproducts Terms Privacy SignupfortheGoogleDevelopersnewsletter Subscribe Language English BahasaIndonesia Deutsch Español Français Português–Brasil Русский 中文–简体 日本語 한국어



請為這篇文章評分?