when i add CampaignBudget like this : private static String addCampaignBudget(GoogleAdsClient googleAdsClient, long customerId) { CampaignBudget budget = CampaignBudget.newBuilder() .setName("Cruise Budget #123" ) .setDeliveryMethod(BudgetDeliveryMethod.STANDARD) .setAmountMicros(500_000L) .build();
CampaignBudgetOperation op = CampaignBudgetOperation.newBuilder().setCreate( budget).build(); try (CampaignBudgetServiceClient campaignBudgetServiceClient = googleAdsClient.getLatestVersion().createCampaignBudgetServiceClient()) { MutateCampaignBudgetsResponse response = campaignBudgetServiceClient.mutateCampaignBudgets( "1949217405", ImmutableList.of(op)); String budgetResourceName = response.getResults(0).getResourceName(); System.out.printf("Added budget: %s%n", budgetResourceName); return budgetResourceName; } } returns OPERATION_NOT_PERMITTED_FOR_CONTEXT Is there something wrong with my parameters? *The following is my error log:* Request ------- MethodName: google.ads.googleads.v18.services.CampaignBudgetService/MutateCampaignBudgets Endpoint: googleads.googleapis.com:443 Headers: {developer-token=REDACTED, x-goog-api-client=gl-java/1.8.0_152__Oracle-Corporation gccl/34.0.0 gapic/34.0.0 gax/2.53.0 grpc/1.66.0} Body: customer_id: "1949217405" operations { create { delivery_method: STANDARD name: "Cruise Budget #123" amount_micros: 500000 } } Response -------- Headers: Metadata(content-type=application/grpc,request-id=QiJMjKCV82dA9zeUyLwYAg,date=Wed, 13 Nov 2024 04:19:35 GMT,alt-svc=h3=":443"; ma=2592000,h3-29=":443"; ma=2592000) Body: null Failure message: errors { error_code { context_error: OPERATION_NOT_PERMITTED_FOR_CONTEXT } message: "The operation is not allowed for the given context." location { field_path_elements { field_name: "operations" index: 0 } } } request_id: "QiJMjKCV82dA9zeUyLwYAg" Status: Status{code=INVALID_ARGUMENT, description=Request contains an invalid argument., cause=null}. Request ID QiJMjKCV82dA9zeUyLwYAg failed due to GoogleAdsException. Underlying errors: Error 0: error_code { context_error: OPERATION_NOT_PERMITTED_FOR_CONTEXT } message: "The operation is not allowed for the given context." location { field_path_elements { field_name: "operations" index: 0 } } -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog: https://googleadsdeveloper.blogspot.com/ =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en --- You received this message because you are subscribed to the Google Groups "Google Ads API and AdWords API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/adwords-api/c3d319b7-b24b-423d-b78c-7c1338a33dean%40googlegroups.com.