다음을 통해 공유


고객 목록 가져오기

적용 대상: 파트너 센터 | 21Vianet에서 운영되는 파트너 센터 | Microsoft Cloud for US Government 파트너 센터

이 문서에서는 파트너의 모든 고객을 나타내는 리소스 컬렉션을 가져오는 방법을 설명합니다.

파트너 센터에서 이 작업을 수행할 수도 있습니다. 홈페이지에서 고객 작업 영역을 선택한 다음, 메뉴의 고객 목록을 사용하여 고객을 봅니다.

필수 구성 요소

  • 자격 증명(파트너 센터 인증에서 설명). 이 시나리오는 독립 실행형 앱 및 App+사용자 자격 증명을 모두 사용하여 인증을 지원합니다.

C#

모든 고객 목록을 얻으려면 다음을 수행합니다.

  1. IAggregatePartner.Customers 컬렉션을 사용하여 IPartner 개체를 만듭니다.

  2. Query() 또는 QueryAsync() 메서드를 사용하여 고객 목록을 검색합니다. (쿼리를 만드는 방법에 대한 지침은 QueryFactory 클래스를 참조하세요.)

// IAggregatePartner partnerOperations;

// All the operations executed on this partner operation instance will share the same correlation Id but will differ in request Id
IPartner scopedPartnerOperations = partnerOperations.With(RequestContextFactory.Instance.Create(Guid.NewGuid()));

// read customers into chunks of 40s
var customersBatch = scopedPartnerOperations.Customers.Query(QueryFactory.Instance.BuildIndexedQuery(40));
var customersEnumerator = scopedPartnerOperations.Enumerators.Customers.Create(customersBatch);

예제는 다음을 참조하세요.

Java

파트너 센터 Java SDK를 사용하여 파트너 센터 리소스를 관리할 수 있습니다. 파트너 커뮤니티에서 유지 관리하고 Microsoft에서 공식적으로 지원하지 않는 오픈 소스 프로젝트입니다. 문제가 발생한 경우 커뮤니티에서 도움을 받거나GitHub에서 문제를 열 수 있습니다.

모든 고객 목록을 얻으려면 다음을 수행합니다.

  1. [IAggregatePartner.getCustomers] 함수를 사용하여 고객 작업에 대한 참조를 가져옵니다.

  2. query() 함수를 사용하여 고객 목록을 검색합니다.

// Query the customers, get the first page if a page size was set, otherwise get all customers
SeekBasedResourceCollection<Customer> customersPage = partnerOperations.getCustomers().query(QueryFactory.getInstance().buildIndexedQuery(40));

// Create a customer enumerator which will aid us in traversing the customer pages
IResourceCollectionEnumerator<SeekBasedResourceCollection<Customer>> customersEnumerator =
    partnerOperations.getEnumerators().getCustomers().create( customersPage );

int pageNumber = 1;

while (customersEnumerator.hasValue())
{
    /*
     * Use the customersEnumerator.getCurrent() function to
     * access the current page of customers.
     */

    // Get the next page of customers
    customersEnumerator.next();
}

PowerShell

파트너 센터 PowerShell 모듈을 사용하여 파트너 센터 리소스를 관리할 수 있습니다. 파트너 커뮤니티에서 유지 관리하고 Microsoft에서 공식적으로 지원하지 않는 오픈 소스 프로젝트입니다. 문제가 발생한 경우 커뮤니티에서 도움을 받거나GitHub에서 문제를 열 수 있습니다.

매개 변수 없이 Get-PartnerCustomer 명령을 실행하여 전체 고객 목록을 가져옵니다.

Get-PartnerCustomer

REST 요청

요청 구문

방법 요청 URI
GET {baseURL}/v1/customers?size={size} HTTP/1.1

URI 매개 변수

다음 쿼리 매개 변수를 사용하여 고객 목록을 가져옵니다.

Name 형식 필수 Description
size int Y 한 번에 표시할 결과 수입니다.

요청 헤더

자세한 내용은 파트너 센터 REST 헤더를 참조하세요.

요청 본문

없음

요청 예제

GET https://api.partnercenter.microsoft.com/v1/customers?size=40 HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 3705fc6d-4127-4a87-bdba-9658f73fe019
MS-CorrelationId: b12260fb-82de-4701-a25f-dcd367690645

REST 응답

성공하면 이 메서드는 응답 본문에 고객 리소스 컬렉션을 반환합니다.

응답 성공 및 오류 코드

각 응답에는 성공 또는 실패와 추가 디버깅 정보를 나타내는 HTTP 상태 코드가 함께 제공됩니다. 네트워크 추적 도구를 사용하여 이 코드, 오류 유형 및 추가 매개 변수를 읽을 수 있습니다. 전체 목록은 오류 코드를 참조하세요.

응답 예제

HTTP/1.1 200 OK
Content-Length: 15650
Content-Type: application/json
MS-CorrelationId: b12260fb-82de-4701-a25f-dcd367690645
MS-RequestId: 3705fc6d-4127-4a87-bdba-9658f73fe019
Date: Fri, 20 Nov 2015 01:08:23 GMT

{
    "totalCount": 2,
    "items": [{
        "id": "b44bb1fb-c595-45b0-9e09-d657365580bf",
        "companyProfile": {
            "tenantId": "<guid>",
            "domain": "domain",
            "companyName": "companyName",
            "attributes": {
                "objectType": "CustomerCompanyProfile"
            }
        },
        "relationshipToPartner": "reseller",
        "attributes": {
            "objectType": "Customer"
        }
    },
    {
        "id": "45c44870-ef77-4fdd-b6fe-3dacb075cff2",
        "companyProfile": {
            "tenantId": "<guid>",
            "domain": "domain",
            "companyName": "companyName",
            "attributes": {
                "objectType": "CustomerCompanyProfile"
            }
        },
        "relationshipToPartner": "reseller",
        "attributes": {
            "objectType": "Customer"
        }
    }],
    "links": {
        "self": {
            "uri": "/v1/customers?size=40",
            "method": "GET",
            "headers": []
        }
    },
    "attributes": {
        "objectType": "Collection"
    }
}