Display & Video 360 API v2 غروب است. به جای آن از Display & Video 360 API v3 استفاده کنید. برای دستورالعملهای انتقال نسخه 2 به نسخه 3، راهنمای مهاجرت ما را ببینید.
آدرس ایمیل کاربر جدید باید دارای یک حساب Google مربوطه باشد که می تواند برای یک آدرس ایمیل موجود ایجاد شود. منبع کاربر ایجاد شده همچنین باید حداقل یک نقش کاربر اختصاص داده شده را شامل شود.
در اینجا مثالی از نحوه ایجاد یک کاربر جدید با دسترسی استاندارد به یک تبلیغکننده آورده شده است:
جاوا
// 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());
پایتون
# 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']);