Edit

Kongsi melalui


GetUser Service Operation - Customer Management

Gets the details of a user.

Tip

Please see the Account Hierchy and User Permissions guide for an overview with examples.

Request Elements

The GetUserRequest object defines the body and header elements of the service operation request. The elements must be in the same order as shown in the Request SOAP.

Note

Unless otherwise noted below, all request elements are required.

Request Body Elements

Element Description Data Type
UserId The identifier of the user to get.

If this element is null or not provided, the response will include details for the authenticated user specified in the request header.
long

Request Header Elements

Element Description Data Type
AuthenticationToken The OAuth access token that represents the credentials of a user who has permissions to Microsoft Advertising accounts.

For more information see Authentication with OAuth.
string
DeveloperToken The developer token used to access the Bing Ads API.

For more information see Get a Developer Token.
string
Password This element is reserved for internal use and will be removed from a future version of the API. You must use the AuthenticationToken element to set user credentials. string
UserName This element is reserved for internal use and will be removed from a future version of the API. You must use the AuthenticationToken element to set user credentials. string

Response Elements

The GetUserResponse object defines the body and header elements of the service operation response. The elements are returned in the same order as shown in the Response SOAP.

Response Body Elements

Element Description Data Type
CustomerRoles The list of roles that a user has for each customer or list of accounts.

At minimum one list item will be returned. If a user's credentials can access multiple customers, then one CustomerRole object per customer will be returned.

You can view all of your own roles across all customers; however, you will only see the roles of other users as it pertains to customers that you can access. For example let's say you@contoso.com and another-user@contoso.com can access Customer A. The other user might also have access to Customer B and C; however when you call this operation with their user identifier, you will only see their role under Customer A. When another-user@contoso.com calls this operation with their own credentials, the operation would return three CustomerRole objects.
CustomerRole array
User A user object that contains information about the user. User

Response Header Elements

Element Description Data Type
TrackingId The identifier of the log entry that contains the details of the API call. string

Request SOAP

This template was generated by a tool to show the order of the body and header elements for the SOAP request. For supported types that you can use with this service operation, see the Request Body Elements reference above.

<s:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header xmlns="https://bingads.microsoft.com/Customer/v13">
    <Action mustUnderstand="1">GetUser</Action>
    <AuthenticationToken i:nil="false">ValueHere</AuthenticationToken>
    <DeveloperToken i:nil="false">ValueHere</DeveloperToken>
  </s:Header>
  <s:Body>
    <GetUserRequest xmlns="https://bingads.microsoft.com/Customer/v13">
      <UserId i:nil="false">ValueHere</UserId>
    </GetUserRequest>
  </s:Body>
</s:Envelope>

Response SOAP

This template was generated by a tool to show the order of the body and header elements for the SOAP response.

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header xmlns="https://bingads.microsoft.com/Customer/v13">
    <TrackingId d3p1:nil="false" xmlns:d3p1="http://www.w3.org/2001/XMLSchema-instance">ValueHere</TrackingId>
  </s:Header>
  <s:Body>
    <GetUserResponse xmlns="https://bingads.microsoft.com/Customer/v13">
      <User xmlns:e239="https://bingads.microsoft.com/Customer/v13/Entities" d4p1:nil="false" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">
        <e239:ContactInfo d4p1:nil="false">
          <e239:Address d4p1:nil="false">
            <e239:City d4p1:nil="false">ValueHere</e239:City>
            <e239:CountryCode d4p1:nil="false">ValueHere</e239:CountryCode>
            <e239:Id d4p1:nil="false">ValueHere</e239:Id>
            <e239:Line1 d4p1:nil="false">ValueHere</e239:Line1>
            <e239:Line2 d4p1:nil="false">ValueHere</e239:Line2>
            <e239:Line3 d4p1:nil="false">ValueHere</e239:Line3>
            <e239:Line4 d4p1:nil="false">ValueHere</e239:Line4>
            <e239:PostalCode d4p1:nil="false">ValueHere</e239:PostalCode>
            <e239:StateOrProvince d4p1:nil="false">ValueHere</e239:StateOrProvince>
            <e239:TimeStamp d4p1:nil="false">ValueHere</e239:TimeStamp>
            <e239:BusinessName d4p1:nil="false">ValueHere</e239:BusinessName>
          </e239:Address>
          <e239:ContactByPhone d4p1:nil="false">ValueHere</e239:ContactByPhone>
          <e239:ContactByPostalMail d4p1:nil="false">ValueHere</e239:ContactByPostalMail>
          <e239:Email d4p1:nil="false">ValueHere</e239:Email>
          <e239:EmailFormat d4p1:nil="false">ValueHere</e239:EmailFormat>
          <e239:Fax d4p1:nil="false">ValueHere</e239:Fax>
          <e239:HomePhone d4p1:nil="false">ValueHere</e239:HomePhone>
          <e239:Id d4p1:nil="false">ValueHere</e239:Id>
          <e239:Mobile d4p1:nil="false">ValueHere</e239:Mobile>
          <e239:Phone1 d4p1:nil="false">ValueHere</e239:Phone1>
          <e239:Phone2 d4p1:nil="false">ValueHere</e239:Phone2>
        </e239:ContactInfo>
        <e239:CustomerId d4p1:nil="false">ValueHere</e239:CustomerId>
        <e239:Id d4p1:nil="false">ValueHere</e239:Id>
        <e239:JobTitle d4p1:nil="false">ValueHere</e239:JobTitle>
        <e239:LastModifiedByUserId d4p1:nil="false">ValueHere</e239:LastModifiedByUserId>
        <e239:LastModifiedTime d4p1:nil="false">ValueHere</e239:LastModifiedTime>
        <e239:Lcid d4p1:nil="false">ValueHere</e239:Lcid>
        <e239:Name d4p1:nil="false">
          <e239:FirstName d4p1:nil="false">ValueHere</e239:FirstName>
          <e239:LastName d4p1:nil="false">ValueHere</e239:LastName>
          <e239:MiddleInitial d4p1:nil="false">ValueHere</e239:MiddleInitial>
        </e239:Name>
        <e239:Password d4p1:nil="false">ValueHere</e239:Password>
        <e239:SecretAnswer d4p1:nil="false">ValueHere</e239:SecretAnswer>
        <e239:SecretQuestion>ValueHere</e239:SecretQuestion>
        <e239:UserLifeCycleStatus d4p1:nil="false">ValueHere</e239:UserLifeCycleStatus>
        <e239:TimeStamp d4p1:nil="false">ValueHere</e239:TimeStamp>
        <e239:UserName d4p1:nil="false">ValueHere</e239:UserName>
        <e239:ForwardCompatibilityMap xmlns:e240="http://schemas.datacontract.org/2004/07/System.Collections.Generic" d4p1:nil="false">
          <e240:KeyValuePairOfstringstring>
            <e240:key d4p1:nil="false">ValueHere</e240:key>
            <e240:value d4p1:nil="false">ValueHere</e240:value>
          </e240:KeyValuePairOfstringstring>
        </e239:ForwardCompatibilityMap>
        <e239:AuthenticationToken d4p1:nil="false">ValueHere</e239:AuthenticationToken>
      </User>
      <CustomerRoles xmlns:e241="https://bingads.microsoft.com/Customer/v13/Entities" d4p1:nil="false" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">
        <e241:CustomerRole>
          <e241:RoleId>ValueHere</e241:RoleId>
          <e241:CustomerId>ValueHere</e241:CustomerId>
          <e241:AccountIds d4p1:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <a1:long>ValueHere</a1:long>
          </e241:AccountIds>
          <e241:LinkedAccountIds d4p1:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <a1:long>ValueHere</a1:long>
          </e241:LinkedAccountIds>
          <e241:CustomerLinkPermission d4p1:nil="false">ValueHere</e241:CustomerLinkPermission>
        </e241:CustomerRole>
      </CustomerRoles>
    </GetUserResponse>
  </s:Body>
</s:Envelope>

Code Syntax

The example syntax can be used with Bing Ads SDKs. See Bing Ads API Code Examples for more examples.

public async Task<GetUserResponse> GetUserAsync(
	long? userId)
{
	var request = new GetUserRequest
	{
		UserId = userId
	};

	return (await CustomerManagementService.CallAsync((s, r) => s.GetUserAsync(r), request));
}
static GetUserResponse getUser(
	java.lang.Long userId) throws RemoteException, Exception
{
	GetUserRequest request = new GetUserRequest();

	request.setUserId(userId);

	return CustomerManagementService.getService().getUser(request);
}
static function GetUser(
	$userId)
{

	$GLOBALS['Proxy'] = $GLOBALS['CustomerManagementProxy'];

	$request = new GetUserRequest();

	$request->UserId = $userId;

	return $GLOBALS['CustomerManagementProxy']->GetService()->GetUser($request);
}
response=customermanagement_service.GetUser(
	UserId=UserId)

Requirements

Service: CustomerManagementService.svc v13
Namespace: https://bingads.microsoft.com/Customer/v13