편집

다음을 통해 공유


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

Request Url

https://clientcenter.api.bingads.microsoft.com/CustomerManagement/v13/User/Query

Request Elements

The GetUserRequest object defines the body and header elements of the service operation request.

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
Authorization The OAuth access token that represents the credentials of a user who has permissions to Microsoft Advertising accounts. Please ensure that the token is prefixed with "Bearer ", this is necessary for proper authentication.

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 JSON.

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 JSON

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

{
  "UserId": "LongValueHere"
}

Response JSON

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

{
  "User": {
    "AuthenticationToken": "ValueHere",
    "ContactInfo": {
      "Address": {
        "BusinessName": "ValueHere",
        "City": "ValueHere",
        "CountryCode": "ValueHere",
        "Id": "LongValueHere",
        "Line1": "ValueHere",
        "Line2": "ValueHere",
        "Line3": "ValueHere",
        "Line4": "ValueHere",
        "PostalCode": "ValueHere",
        "StateOrProvince": "ValueHere",
        "TimeStamp": "ValueHere"
      },
      "ContactByPhone": "ValueHere",
      "ContactByPostalMail": "ValueHere",
      "Email": "ValueHere",
      "EmailFormat": "ValueHere",
      "Fax": "ValueHere",
      "HomePhone": "ValueHere",
      "Id": "LongValueHere",
      "Mobile": "ValueHere",
      "Phone1": "ValueHere",
      "Phone2": "ValueHere"
    },
    "CustomerId": "LongValueHere",
    "ForwardCompatibilityMap": [
      {
        "key": "ValueHere",
        "value": "ValueHere"
      }
    ],
    "Id": "LongValueHere",
    "JobTitle": "ValueHere",
    "LastModifiedByUserId": "LongValueHere",
    "LastModifiedTime": "ValueHere",
    "Lcid": "ValueHere",
    "Name": {
      "FirstName": "ValueHere",
      "LastName": "ValueHere",
      "MiddleInitial": "ValueHere"
    },
    "Password": "ValueHere",
    "SecretAnswer": "ValueHere",
    "SecretQuestion": "ValueHere",
    "TimeStamp": "ValueHere",
    "UserLifeCycleStatus": "ValueHere",
    "UserName": "ValueHere"
  },
  "CustomerRoles": [
    {
      "AccountIds": [
        "LongValueHere"
      ],
      "CustomerId": "LongValueHere",
      "CustomerLinkPermission": "ValueHere",
      "LinkedAccountIds": [
        "LongValueHere"
      ],
      "RoleId": IntValueHere
    }
  ]
}

Code Syntax

To call REST API through SDKs, you need to upgrade SDK to a certain version and configure the system parameters.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)