Class GoogleAdsServiceClient
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource,AutoCloseable
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (GoogleAdsServiceClient googleAdsServiceClient = GoogleAdsServiceClient.create()) {
String customerId = "customerId-1581184615";
List<MutateOperation> mutateOperations = new ArrayList<>();
MutateGoogleAdsResponse response =
googleAdsServiceClient.mutate(customerId, mutateOperations);
}
Note: close() needs to be called on the GoogleAdsServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
Search |
Returns all rows that match the search query. List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ChangeEventError]() [ChangeStatusError]() [ClickViewError]() [HeaderError]() [InternalError]() [QueryError]() [QuotaError]() [RequestError]() |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
SearchStream |
Returns all rows that match the search stream query. List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ChangeEventError]() [ChangeStatusError]() [ClickViewError]() [HeaderError]() [InternalError]() [QueryError]() [QuotaError]() [RequestError]() |
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
Mutate |
Creates, updates, or removes resources. This method supports atomic transactions with multiple types of resources. For example, you can atomically create a campaign and a campaign budget, or perform up to thousands of mutates atomically. This method is essentially a wrapper around a series of mutate methods. The only features it offers over calling those methods directly are: - Atomic transactions - Temp resource names (described below) - Somewhat reduced latency over making a series of mutate calls Note: Only resources that support atomic transactions are included, so this method can't replace all calls to individual services. ## Atomic Transaction Benefits Atomicity makes error handling much easier. If you're making a series of changes and one fails, it can leave your account in an inconsistent state. With atomicity, you either reach the chosen state directly, or the request fails and you can retry. ## Temp Resource Names Temp resource names are a special type of resource name used to create a resource and reference that resource in the same request. For example, if a campaign budget is created with `resource_name` equal to `customers/123/campaignBudgets/-1`, that resource name can be reused in the `Campaign.budget` field in the same request. That way, the two resources are created and linked atomically. To create a temp resource name, put a negative number in the part of the name that the server would normally allocate. Note: - Resources must be created with a temp name before the name can be reused. For example, the previous CampaignBudget+Campaign example would fail if the mutate order was reversed. - Temp names are not remembered across requests. - There's no limit to the number of temp names in a request. - Each temp name must use a unique negative number, even if the resource types differ. ## Latency It's important to group mutates by resource type or the request may time out and fail. Latency is roughly equal to a series of calls to individual mutate methods, where each change in resource type is a new call. For example, mutating 10 campaigns then 10 ad groups is like 2 calls, while mutating 1 campaign, 1 ad group, 1 campaign, 1 ad group is like 4 calls. List of thrown errors: [AdCustomizerError]() [AdError]() [AdGroupAdError]() [AdGroupCriterionError]() [AdGroupError]() [AssetError]() [AuthenticationError]() [AuthorizationError]() [BiddingError]() [CampaignBudgetError]() [CampaignCriterionError]() [CampaignError]() [CampaignExperimentError]() [CampaignSharedSetError]() [CollectionSizeError]() [ContextError]() [ConversionActionError]() [CriterionError]() [CustomerFeedError]() [DatabaseError]() [DateError]() [DateRangeError]() [DistinctError]() [ExtensionFeedItemError]() [ExtensionSettingError]() [FeedAttributeReferenceError]() [FeedError]() [FeedItemError]() [FeedItemSetError]() [FieldError]() [FieldMaskError]() [FunctionParsingError]() [HeaderError]() [ImageError]() [InternalError]() [KeywordPlanAdGroupKeywordError]() [KeywordPlanCampaignError]() [KeywordPlanError]() [LabelError]() [ListOperationError]() [MediaUploadError]() [MutateError]() [NewResourceCreationError]() [NullError]() [OperationAccessDeniedError]() [PolicyFindingError]() [PolicyViolationError]() [QuotaError]() [RangeError]() [RequestError]() [ResourceCountLimitExceededError]() [SettingError]() [SharedSetError]() [SizeLimitError]() [StringFormatError]() [StringLengthError]() [UrlFieldError]() [UserListError]() [YoutubeVideoRegistrationError]() |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of GoogleAdsServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
GoogleAdsServiceSettings googleAdsServiceSettings =
GoogleAdsServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
GoogleAdsServiceClient googleAdsServiceClient =
GoogleAdsServiceClient.create(googleAdsServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
GoogleAdsServiceSettings googleAdsServiceSettings =
GoogleAdsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
GoogleAdsServiceClient googleAdsServiceClient =
GoogleAdsServiceClient.create(googleAdsServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs an instance of GoogleAdsServiceClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) final voidclose()static final GoogleAdsServiceClientcreate()Constructs an instance of GoogleAdsServiceClient with default settings.static final GoogleAdsServiceClientcreate(GoogleAdsServiceSettings settings) Constructs an instance of GoogleAdsServiceClient, using the given settings.static final GoogleAdsServiceClientcreate(GoogleAdsServiceStub stub) Constructs an instance of GoogleAdsServiceClient, using the given stub for making calls.final GoogleAdsServiceSettingsgetStub()booleanbooleanfinal MutateGoogleAdsResponsemutate(MutateGoogleAdsRequest request) Creates, updates, or removes resources.final MutateGoogleAdsResponsemutate(String customerId, List<MutateOperation> mutateOperations) Creates, updates, or removes resources.final com.google.api.gax.rpc.UnaryCallable<MutateGoogleAdsRequest,MutateGoogleAdsResponse> Creates, updates, or removes resources.search(SearchGoogleAdsRequest request) Returns all rows that match the search query.Returns all rows that match the search query.final com.google.api.gax.rpc.UnaryCallable<SearchGoogleAdsRequest,SearchGoogleAdsResponse> Returns all rows that match the search query.final com.google.api.gax.rpc.UnaryCallable<SearchGoogleAdsRequest,GoogleAdsServiceClient.SearchPagedResponse> Returns all rows that match the search query.final com.google.api.gax.rpc.ServerStreamingCallable<SearchGoogleAdsStreamRequest,SearchGoogleAdsStreamResponse> Returns all rows that match the search stream query.voidshutdown()void
-
Constructor Details
-
GoogleAdsServiceClient
Constructs an instance of GoogleAdsServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.- Throws:
IOException
-
GoogleAdsServiceClient
-
-
Method Details
-
create
Constructs an instance of GoogleAdsServiceClient with default settings.- Throws:
IOException
-
create
public static final GoogleAdsServiceClient create(GoogleAdsServiceSettings settings) throws IOException Constructs an instance of GoogleAdsServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
Constructs an instance of GoogleAdsServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(GoogleAdsServiceSettings). -
getSettings
-
getStub
-
search
Returns all rows that match the search query.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ChangeEventError]() [ChangeStatusError]() [ClickViewError]() [HeaderError]() [InternalError]() [QueryError]() [QuotaError]() [RequestError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (GoogleAdsServiceClient googleAdsServiceClient = GoogleAdsServiceClient.create()) { String customerId = "customerId-1581184615"; String query = "query107944136"; for (GoogleAdsRow element : googleAdsServiceClient.search(customerId, query).iterateAll()) { // doThingsWith(element); } }- Parameters:
customerId- Required. The ID of the customer being queried.query- Required. The query string.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
search
Returns all rows that match the search query.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ChangeEventError]() [ChangeStatusError]() [ClickViewError]() [HeaderError]() [InternalError]() [QueryError]() [QuotaError]() [RequestError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (GoogleAdsServiceClient googleAdsServiceClient = GoogleAdsServiceClient.create()) { SearchGoogleAdsRequest request = SearchGoogleAdsRequest.newBuilder() .setCustomerId("customerId-1581184615") .setQuery("query107944136") .setPageToken("pageToken873572522") .setPageSize(883849137) .setValidateOnly(true) .setSearchSettings(SearchSettings.newBuilder().build()) .build(); for (GoogleAdsRow element : googleAdsServiceClient.search(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
searchPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<SearchGoogleAdsRequest,GoogleAdsServiceClient.SearchPagedResponse> searchPagedCallable()Returns all rows that match the search query.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ChangeEventError]() [ChangeStatusError]() [ClickViewError]() [HeaderError]() [InternalError]() [QueryError]() [QuotaError]() [RequestError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (GoogleAdsServiceClient googleAdsServiceClient = GoogleAdsServiceClient.create()) { SearchGoogleAdsRequest request = SearchGoogleAdsRequest.newBuilder() .setCustomerId("customerId-1581184615") .setQuery("query107944136") .setPageToken("pageToken873572522") .setPageSize(883849137) .setValidateOnly(true) .setSearchSettings(SearchSettings.newBuilder().build()) .build(); ApiFuture<GoogleAdsRow> future = googleAdsServiceClient.searchPagedCallable().futureCall(request); // Do something. for (GoogleAdsRow element : future.get().iterateAll()) { // doThingsWith(element); } } -
searchCallable
public final com.google.api.gax.rpc.UnaryCallable<SearchGoogleAdsRequest,SearchGoogleAdsResponse> searchCallable()Returns all rows that match the search query.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ChangeEventError]() [ChangeStatusError]() [ClickViewError]() [HeaderError]() [InternalError]() [QueryError]() [QuotaError]() [RequestError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (GoogleAdsServiceClient googleAdsServiceClient = GoogleAdsServiceClient.create()) { SearchGoogleAdsRequest request = SearchGoogleAdsRequest.newBuilder() .setCustomerId("customerId-1581184615") .setQuery("query107944136") .setPageToken("pageToken873572522") .setPageSize(883849137) .setValidateOnly(true) .setSearchSettings(SearchSettings.newBuilder().build()) .build(); while (true) { SearchGoogleAdsResponse response = googleAdsServiceClient.searchCallable().call(request); for (GoogleAdsRow element : response.getResultsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
searchStreamCallable
public final com.google.api.gax.rpc.ServerStreamingCallable<SearchGoogleAdsStreamRequest,SearchGoogleAdsStreamResponse> searchStreamCallable()Returns all rows that match the search stream query.List of thrown errors: [AuthenticationError]() [AuthorizationError]() [ChangeEventError]() [ChangeStatusError]() [ClickViewError]() [HeaderError]() [InternalError]() [QueryError]() [QuotaError]() [RequestError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (GoogleAdsServiceClient googleAdsServiceClient = GoogleAdsServiceClient.create()) { SearchGoogleAdsStreamRequest request = SearchGoogleAdsStreamRequest.newBuilder() .setCustomerId("customerId-1581184615") .setQuery("query107944136") .build(); ServerStream<SearchGoogleAdsStreamResponse> stream = googleAdsServiceClient.searchStreamCallable().call(request); for (SearchGoogleAdsStreamResponse response : stream) { // Do something when a response is received. } } -
mutate
public final MutateGoogleAdsResponse mutate(String customerId, List<MutateOperation> mutateOperations) Creates, updates, or removes resources. This method supports atomic transactions with multiple types of resources. For example, you can atomically create a campaign and a campaign budget, or perform up to thousands of mutates atomically.This method is essentially a wrapper around a series of mutate methods. The only features it offers over calling those methods directly are:
- Atomic transactions - Temp resource names (described below) - Somewhat reduced latency over making a series of mutate calls
Note: Only resources that support atomic transactions are included, so this method can't replace all calls to individual services.
## Atomic Transaction Benefits
Atomicity makes error handling much easier. If you're making a series of changes and one fails, it can leave your account in an inconsistent state. With atomicity, you either reach the chosen state directly, or the request fails and you can retry.
## Temp Resource Names
Temp resource names are a special type of resource name used to create a resource and reference that resource in the same request. For example, if a campaign budget is created with `resource_name` equal to `customers/123/campaignBudgets/-1`, that resource name can be reused in the `Campaign.budget` field in the same request. That way, the two resources are created and linked atomically.
To create a temp resource name, put a negative number in the part of the name that the server would normally allocate.
Note:
- Resources must be created with a temp name before the name can be reused. For example, the previous CampaignBudget+Campaign example would fail if the mutate order was reversed. - Temp names are not remembered across requests. - There's no limit to the number of temp names in a request. - Each temp name must use a unique negative number, even if the resource types differ.
## Latency
It's important to group mutates by resource type or the request may time out and fail. Latency is roughly equal to a series of calls to individual mutate methods, where each change in resource type is a new call. For example, mutating 10 campaigns then 10 ad groups is like 2 calls, while mutating 1 campaign, 1 ad group, 1 campaign, 1 ad group is like 4 calls.
List of thrown errors: [AdCustomizerError]() [AdError]() [AdGroupAdError]() [AdGroupCriterionError]() [AdGroupError]() [AssetError]() [AuthenticationError]() [AuthorizationError]() [BiddingError]() [CampaignBudgetError]() [CampaignCriterionError]() [CampaignError]() [CampaignExperimentError]() [CampaignSharedSetError]() [CollectionSizeError]() [ContextError]() [ConversionActionError]() [CriterionError]() [CustomerFeedError]() [DatabaseError]() [DateError]() [DateRangeError]() [DistinctError]() [ExtensionFeedItemError]() [ExtensionSettingError]() [FeedAttributeReferenceError]() [FeedError]() [FeedItemError]() [FeedItemSetError]() [FieldError]() [FieldMaskError]() [FunctionParsingError]() [HeaderError]() [ImageError]() [InternalError]() [KeywordPlanAdGroupKeywordError]() [KeywordPlanCampaignError]() [KeywordPlanError]() [LabelError]() [ListOperationError]() [MediaUploadError]() [MutateError]() [NewResourceCreationError]() [NullError]() [OperationAccessDeniedError]() [PolicyFindingError]() [PolicyViolationError]() [QuotaError]() [RangeError]() [RequestError]() [ResourceCountLimitExceededError]() [SettingError]() [SharedSetError]() [SizeLimitError]() [StringFormatError]() [StringLengthError]() [UrlFieldError]() [UserListError]() [YoutubeVideoRegistrationError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (GoogleAdsServiceClient googleAdsServiceClient = GoogleAdsServiceClient.create()) { String customerId = "customerId-1581184615"; List<MutateOperation> mutateOperations = new ArrayList<>(); MutateGoogleAdsResponse response = googleAdsServiceClient.mutate(customerId, mutateOperations); }- Parameters:
customerId- Required. The ID of the customer whose resources are being modified.mutateOperations- Required. The list of operations to perform on individual resources.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
mutate
Creates, updates, or removes resources. This method supports atomic transactions with multiple types of resources. For example, you can atomically create a campaign and a campaign budget, or perform up to thousands of mutates atomically.This method is essentially a wrapper around a series of mutate methods. The only features it offers over calling those methods directly are:
- Atomic transactions - Temp resource names (described below) - Somewhat reduced latency over making a series of mutate calls
Note: Only resources that support atomic transactions are included, so this method can't replace all calls to individual services.
## Atomic Transaction Benefits
Atomicity makes error handling much easier. If you're making a series of changes and one fails, it can leave your account in an inconsistent state. With atomicity, you either reach the chosen state directly, or the request fails and you can retry.
## Temp Resource Names
Temp resource names are a special type of resource name used to create a resource and reference that resource in the same request. For example, if a campaign budget is created with `resource_name` equal to `customers/123/campaignBudgets/-1`, that resource name can be reused in the `Campaign.budget` field in the same request. That way, the two resources are created and linked atomically.
To create a temp resource name, put a negative number in the part of the name that the server would normally allocate.
Note:
- Resources must be created with a temp name before the name can be reused. For example, the previous CampaignBudget+Campaign example would fail if the mutate order was reversed. - Temp names are not remembered across requests. - There's no limit to the number of temp names in a request. - Each temp name must use a unique negative number, even if the resource types differ.
## Latency
It's important to group mutates by resource type or the request may time out and fail. Latency is roughly equal to a series of calls to individual mutate methods, where each change in resource type is a new call. For example, mutating 10 campaigns then 10 ad groups is like 2 calls, while mutating 1 campaign, 1 ad group, 1 campaign, 1 ad group is like 4 calls.
List of thrown errors: [AdCustomizerError]() [AdError]() [AdGroupAdError]() [AdGroupCriterionError]() [AdGroupError]() [AssetError]() [AuthenticationError]() [AuthorizationError]() [BiddingError]() [CampaignBudgetError]() [CampaignCriterionError]() [CampaignError]() [CampaignExperimentError]() [CampaignSharedSetError]() [CollectionSizeError]() [ContextError]() [ConversionActionError]() [CriterionError]() [CustomerFeedError]() [DatabaseError]() [DateError]() [DateRangeError]() [DistinctError]() [ExtensionFeedItemError]() [ExtensionSettingError]() [FeedAttributeReferenceError]() [FeedError]() [FeedItemError]() [FeedItemSetError]() [FieldError]() [FieldMaskError]() [FunctionParsingError]() [HeaderError]() [ImageError]() [InternalError]() [KeywordPlanAdGroupKeywordError]() [KeywordPlanCampaignError]() [KeywordPlanError]() [LabelError]() [ListOperationError]() [MediaUploadError]() [MutateError]() [NewResourceCreationError]() [NullError]() [OperationAccessDeniedError]() [PolicyFindingError]() [PolicyViolationError]() [QuotaError]() [RangeError]() [RequestError]() [ResourceCountLimitExceededError]() [SettingError]() [SharedSetError]() [SizeLimitError]() [StringFormatError]() [StringLengthError]() [UrlFieldError]() [UserListError]() [YoutubeVideoRegistrationError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (GoogleAdsServiceClient googleAdsServiceClient = GoogleAdsServiceClient.create()) { MutateGoogleAdsRequest request = MutateGoogleAdsRequest.newBuilder() .setCustomerId("customerId-1581184615") .addAllMutateOperations(new ArrayList<MutateOperation>()) .setPartialFailure(true) .setValidateOnly(true) .build(); MutateGoogleAdsResponse response = googleAdsServiceClient.mutate(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
mutateCallable
public final com.google.api.gax.rpc.UnaryCallable<MutateGoogleAdsRequest,MutateGoogleAdsResponse> mutateCallable()Creates, updates, or removes resources. This method supports atomic transactions with multiple types of resources. For example, you can atomically create a campaign and a campaign budget, or perform up to thousands of mutates atomically.This method is essentially a wrapper around a series of mutate methods. The only features it offers over calling those methods directly are:
- Atomic transactions - Temp resource names (described below) - Somewhat reduced latency over making a series of mutate calls
Note: Only resources that support atomic transactions are included, so this method can't replace all calls to individual services.
## Atomic Transaction Benefits
Atomicity makes error handling much easier. If you're making a series of changes and one fails, it can leave your account in an inconsistent state. With atomicity, you either reach the chosen state directly, or the request fails and you can retry.
## Temp Resource Names
Temp resource names are a special type of resource name used to create a resource and reference that resource in the same request. For example, if a campaign budget is created with `resource_name` equal to `customers/123/campaignBudgets/-1`, that resource name can be reused in the `Campaign.budget` field in the same request. That way, the two resources are created and linked atomically.
To create a temp resource name, put a negative number in the part of the name that the server would normally allocate.
Note:
- Resources must be created with a temp name before the name can be reused. For example, the previous CampaignBudget+Campaign example would fail if the mutate order was reversed. - Temp names are not remembered across requests. - There's no limit to the number of temp names in a request. - Each temp name must use a unique negative number, even if the resource types differ.
## Latency
It's important to group mutates by resource type or the request may time out and fail. Latency is roughly equal to a series of calls to individual mutate methods, where each change in resource type is a new call. For example, mutating 10 campaigns then 10 ad groups is like 2 calls, while mutating 1 campaign, 1 ad group, 1 campaign, 1 ad group is like 4 calls.
List of thrown errors: [AdCustomizerError]() [AdError]() [AdGroupAdError]() [AdGroupCriterionError]() [AdGroupError]() [AssetError]() [AuthenticationError]() [AuthorizationError]() [BiddingError]() [CampaignBudgetError]() [CampaignCriterionError]() [CampaignError]() [CampaignExperimentError]() [CampaignSharedSetError]() [CollectionSizeError]() [ContextError]() [ConversionActionError]() [CriterionError]() [CustomerFeedError]() [DatabaseError]() [DateError]() [DateRangeError]() [DistinctError]() [ExtensionFeedItemError]() [ExtensionSettingError]() [FeedAttributeReferenceError]() [FeedError]() [FeedItemError]() [FeedItemSetError]() [FieldError]() [FieldMaskError]() [FunctionParsingError]() [HeaderError]() [ImageError]() [InternalError]() [KeywordPlanAdGroupKeywordError]() [KeywordPlanCampaignError]() [KeywordPlanError]() [LabelError]() [ListOperationError]() [MediaUploadError]() [MutateError]() [NewResourceCreationError]() [NullError]() [OperationAccessDeniedError]() [PolicyFindingError]() [PolicyViolationError]() [QuotaError]() [RangeError]() [RequestError]() [ResourceCountLimitExceededError]() [SettingError]() [SharedSetError]() [SizeLimitError]() [StringFormatError]() [StringLengthError]() [UrlFieldError]() [UserListError]() [YoutubeVideoRegistrationError]()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (GoogleAdsServiceClient googleAdsServiceClient = GoogleAdsServiceClient.create()) { MutateGoogleAdsRequest request = MutateGoogleAdsRequest.newBuilder() .setCustomerId("customerId-1581184615") .addAllMutateOperations(new ArrayList<MutateOperation>()) .setPartialFailure(true) .setValidateOnly(true) .build(); ApiFuture<MutateGoogleAdsResponse> future = googleAdsServiceClient.mutateCallable().futureCall(request); // Do something. MutateGoogleAdsResponse response = future.get(); } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfacecom.google.api.gax.core.BackgroundResource- Throws:
InterruptedException
-