Alamat email pengguna baru harus memiliki Akun Google yang sesuai, yang dapat
dibuat untuk alamat email yang sudah ada. Pengguna
resource yang dibuat juga harus menyertakan minimal satu peran pengguna yang ditetapkan.
Berikut ini contoh cara membuat pengguna baru dengan akses standar ke
pengiklan:
Java
// Create the user structure.Useruser=newUser();user.setEmail(email-address);user.setDisplayName(display-name);// Create the assigned user role structure.AssignedUserRoleassignedUserRole=newAssignedUserRole();assignedUserRole.setAdvertiserId(advertiser-id);assignedUserRole.setUserRole("STANDARD");// Add assigned user role list to the user.user.setAssignedUserRoles(ImmutableList.of(assignedUserRole));// Configure the create request.Users.Createrequest=service.users().create(user);// Create the user.Userresponse=request.execute();// Display the user.System.out.printf("User %s was created with email %s.",response.getName(),response.getEmail());
Python
# Create a user object.user_obj={'email':email-address,'displayName':display-name,'assignedUserRoles':[{'advertiserId':advertiser-id,'userRole':'STANDARD'}]}# Build request.request=service.users().create(body=user_obj)# Execute request.response=request.execute()# Display the new user.print('User %s was created with email %s.'%(response['name'],response['email']))
PHP
// Create the user structure.$user = new Google_Service_DisplayVideo_User();$user->setEmail(email-address);$user->setDisplayName(display-name);// Create the assigned user role structure.$assignedUserRole = new Google_Service_DisplayVideo_AssignedUserRole();$assignedUserRole->setAdvertiserId(advertiser-id);$assignedUserRole->setUserRole('STANDARD');// Add assigned user role list to the user.$user->setAssignedUserRoles(array($assignedUserRole));// Call the API, creating the user with the assigned user role.$result = $this->service->users->create($user);// Display the user.printf( 'User %s was created with email %s.\n', $result['name'], $result['email']);
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2024-09-10 UTC."],[[["Admins can create users with access to resources they manage, including sub-resources."],["New users require a Google Account and at least one assigned user role for access."],["The `user.create` method enables user creation, potentially adding roles to existing, inaccessible Display & Video 360 users without error."],["Code samples in Java, Python, and PHP demonstrate creating a standard access user for an advertiser."]]],["Users with the Admin role can create new users via the `user.create` method. A new user's email must have a corresponding Google Account and at least one assigned user role. The process involves creating a user object, assigning a user role (e.g., STANDARD), and then executing the creation request. If the email already belongs to a user, roles will be added to it. The examples provided show creating a user with standard access to an advertiser in Java, Python and PHP.\n"]]