उपयोगकर्ता ऐक्सेस के न्योतों को मैनेज करना

Google Ads खाते के एडमिन के तौर पर, आपके पास Google Ads खाते में उपयोगकर्ता के ऐक्सेस के लिए न्योते मैनेज करने की सुविधा होती है जोड़ें.

उपयोगकर्ताओं को न्योता भेजना

आप इसके तहत किसी नए उपयोगकर्ता को ईमेल से न्योता भेज सकते हैं: Google Ads खाते का ऐक्सेस मैनेज करना. ऐसा करने के लिए CustomerUserAccessInvitation इसका इस्तेमाल करके MutateCustomerUserAccessInvitation तरीका CustomerUserAccessInvitationService. न्योते का ईमेल मैन्युअल तरीके से भेजा जाना चाहिए न्योता पाने वाले उपयोगकर्ता ने स्वीकार किया. इसके लिए, न्योता भेजने वाले व्यक्ति को वैकल्पिक ईमेल पते का उपयोग करके उपयोगकर्ता द्वारा स्वीकार किया जाता है. इसमें 24 लग सकते हैं न्योता स्वीकार होने के बाद, स्टेटस को 'मंज़ूरी बाकी है' से बदलने के लिए घंटे.

यह कोड स्निपेट न्योता भेजने का तरीका बताता है:

Java

// Constructs an access invitation.
CustomerUserAccessInvitation invitation =
    CustomerUserAccessInvitation.newBuilder()
        .setEmailAddress(emailAddress)
        .setAccessRole(accessRole)
        .build();

// Constructs an operation to send the invitation.
CustomerUserAccessInvitationOperation operation =
    CustomerUserAccessInvitationOperation.newBuilder().setCreate(invitation).build();

// Creates a CustomerUserAccessInvitationServiceClient.
try (CustomerUserAccessInvitationServiceClient client =
    googleAdsClient.getLatestVersion().createCustomerUserAccessInvitationServiceClient()) {
  // Issues the request.
  MutateCustomerUserAccessInvitationResponse response =
      client.mutateCustomerUserAccessInvitation(String.valueOf(customerId), operation);

  // Prints some information about the result.
  System.out.printf(
      "Customer user access invitation was sent for customerId = "
          + "%d to email address = '%s' and access role = '%s'. The invitation resource "
          + "name is '%s'.%n",
      customerId, emailAddress, accessRole, response.getResult().getResourceName());
}
      

C#

MutateCustomerUserAccessInvitationRequest invitationRequest =
    new MutateCustomerUserAccessInvitationRequest()
    {
        CustomerId = customerId.ToString(),
        Operation = new CustomerUserAccessInvitationOperation()
        {
            Create = new CustomerUserAccessInvitation()
            {
                EmailAddress = emailAddress,
                AccessRole = accessRole
            },
        }
    };
try
{
    var response = service.MutateCustomerUserAccessInvitation(invitationRequest);

    Console.WriteLine("Customer user access invitation was sent for customerId = " +
        "{0} to email address = {1} and access role = {2}. The invitation resource " +
        "name is {3}.", customerId, emailAddress, accessRole,
        response.Result.ResourceName);
}
catch (GoogleAdsException e)
{
    Console.WriteLine("Failure:");
    Console.WriteLine($"Message: {e.Message}");
    Console.WriteLine($"Failure: {e.Failure}");
    Console.WriteLine($"Request ID: {e.RequestId}");
    throw;
}
      

PHP

// Creates a customer user access invitation.
$customerUserAccessInvitation = new CustomerUserAccessInvitation([
    'email_address' =>  $emailAddress,
    'access_role' => AccessRole::value($accessRole)
]);

// Creates a customer user access invitation operation.
$customerUserAccessInvitationOperation = new CustomerUserAccessInvitationOperation();
$customerUserAccessInvitationOperation->setCreate($customerUserAccessInvitation);

// Issues a mutate request to send the customer user access invitation and prints its
// information.
$customerUserAccessInvitationServiceClient =
    $googleAdsClient->getCustomerUserAccessInvitationServiceClient();
$response = $customerUserAccessInvitationServiceClient->mutateCustomerUserAccessInvitation(
    MutateCustomerUserAccessInvitationRequest::build(
        $customerId,
        $customerUserAccessInvitationOperation
    )
);
printf(
    "Customer user access invitation with resource name '%s' was sent from customer "
    . "ID %d to email address '%s' with access role '%s'.%s",
    $response->getResult()->getResourceName(),
    $customerId,
    $emailAddress,
    $accessRole,
    PHP_EOL
);
      

Python

invitation_operation = client.get_type(
    "CustomerUserAccessInvitationOperation"
)
invitation = invitation_operation.create
invitation.email_address = email_address
invitation.access_role = client.enums.AccessRoleEnum[access_role].value

response = service.mutate_customer_user_access_invitation(
    customer_id=customer_id, operation=invitation_operation
)
print(
    "Customer user access invitation was sent for "
    f"customer ID: '{customer_id}', "
    f"email address {email_address}, and "
    f"access role {access_role}. The invitation resource name is: "
    f"{response.result.resource_name}"
)
      

Ruby

operation = client.operation.create_resource.customer_user_access_invitation do |inv|
  inv.email_address = email_address
  inv.access_role = access_role
end

# Issues a mutate request to get the response.
response = client.service.customer_user_access_invitation.mutate_customer_user_access_invitation(
  customer_id: customer_id,
  operation: operation,
)

# Prints out information of the created invitation.
puts "Customer user access invitation was sent for customerId = #{customer_id} " \
  "email address = '#{email_address}', " \
  "access role = '#{access_role}'."
      

Perl

sub invite_user_with_access_role {
  my ($api_client, $customer_id, $email_address, $access_role) = @_;

  # Create the user access invitation.
  my $user_access_invitation =
    Google::Ads::GoogleAds::V17::Resources::CustomerUserAccessInvitation->new({
      emailAddress => $email_address,
      accessRole   => $access_role
    });

  # Create the user access invitation operation.
  my $invitation_operation =
    Google::Ads::GoogleAds::V17::Services::CustomerUserAccessInvitationService::CustomerUserAccessInvitationOperation
    ->new({create => $user_access_invitation});

  # Send the user access invitation.
  my $invitation_response =
    $api_client->CustomerUserAccessInvitationService()->mutate({
      customerId => $customer_id,
      operation  => $invitation_operation
    });

  printf "Customer user access invitation was sent for customerId = %d " .
    "to email address = '%s' and access role = '%s'. " .
    "The invitation resource name is '%s'.\n",
    $customer_id, $email_address, $access_role,
    $invitation_response->{result}{resourceName};

  return 1;
}
      

न्योते रद्द करना

आप इसका इस्तेमाल करके CustomerUserAccessInvitation को हटाकर किसी न्योते को रद्द कर सकते हैं MutateCustomerUserAccessInvitation तरीका CustomerUserAccessInvitationService.

उपयोगकर्ताओं के न्योते वापस पाना

आप Google Ads क्वेरी भाषा स्टेटमेंट की मदद से CustomerUserAccessInvitation इकाइयां ग्राहक आईडी से जुड़ा हुआ है. यहां एक सामान्य क्वेरी दी गई है:

SELECT
    customer_user_access_invitation.invitation_id,
    customer_user_access_invitation.email_address,
    customer_user_access_invitation.access_role,
    customer_user_access_invitation.invitation_status,
    customer_user_access_invitation.creation_date_time
FROM
    customer_user_access_invitation

न्योतों के सबसेट को फिर से पाने के लिए, फ़िल्टर करने की कुछ और शर्तें जोड़ी जा सकती हैं. उदाहरण के लिए, इस्तेमाल का एक सामान्य उदाहरण यह है कि उस उपयोगकर्ता की सूची को फिर से हासिल किया जाए जिसे मंज़ूरी मिलना बाकी है न्योते. ऐसा करने के लिए, customer_user_access_invitation.invitation_status = PENDING: