다음을 통해 공유


고객의 구독 가져오기

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

고객의 구독 컬렉션을 가져오는 방법입니다.

필수 조건

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

  • 고객 ID (customer-tenant-id). 고객의 ID를 모르는 경우 고객 작업 영역, 고객 목록에서 고객, 계정을 선택하여파트너 센터에서 조회할 수 있습니다. 고객의 계정 페이지에서 고객 계정 정보 섹션에서 Microsoft ID습니다. Microsoft ID는 고객 ID(customer-tenant-id)와 동일합니다.

C#

고객의 모든 구독 목록을 얻으려면 먼저 고객 식별자와 함께 IAggregatePartner.Customers.ById 메서드를 사용하여 고객을 식별합니다. 그런 다음 Subscriptions 속성을 사용하여 구독 컬렉션 작업에 대한 인터페이스를 검색합니다. 마지막으로 Get 또는 GetAsync 메서드를 호출하여 고객의 구독 컬렉션을 검색합니다.

// IAggregatePartner partnerOperations;
// string customerId;

var customerSubscriptions = partnerOperations.Customers.ById(customerId).Subscriptions.Get();

샘플: 콘솔 테스트 앱. 프로젝트: 파트너 센터 SDK 샘플 클래스: GetSubscriptions.cs

REST 요청

요청 구문

메서드 요청 URI
GET {baseURL}/v1/customers/{customer-tenant-id}/subscriptions HTTP/1.1

URI 매개 변수

이 표에는 모든 구독을 가져오는 데 필요한 쿼리 매개 변수가 나열됩니다.

이름 종류 필요함 설명
customer-tenant-id string 고객을 식별하는 GUID 형식 문자열입니다.

요청 헤더

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

요청 본문

없음.

요청 예제

GET https://api.partnercenter.microsoft.com/v1/customers/<customer-tenant-id>/subscriptions HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: b2d13828-2ca5-41d4-94fb-9946214f4244
MS-CorrelationId: c49004b1-224f-4d86-a607-6c8bcc52cfdd
Connection: Keep-Alive

REST 응답

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

응답 성공 및 오류 코드

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

응답 예제

레거시 온라인 서비스 구독에 대한 응답 예제

HTTP/1.1 200 OK
Content-Length: 73754
Content-Type: application/json
MS-CorrelationId: c49004b1-224f-4d86-a607-6c8bcc52cfdd
MS-RequestId: b2d13828-2ca5-41d4-94fb-9946214f4244
Date: Wed, 25 Nov 2015 05:43:06 GMT

{
    "totalCount": 1,
    "items": [{
        "id": "83ef9d05-4169-4ef9-9657-0e86b1eab1de",
        "entitlementId": "a356ac8c-e310-44f4-bf85-C7f29044af99",
        "friendlyName": "nickname",
        "quantity": 1,
        "unitType": "none",
        "creationDate": "2015-11-25T06: 41: 12Z",
        "effectiveStartDate": "2015-11-24T08: 00: 00Z",
        "commitmentEndDate": "2016-12-12T08: 00: 00Z",
        "status": "active",
        "autoRenewEnabled": false,
        "billingType": "none",
        "contractType": "subscription",
        "links": {
            "offer": {
                "uri": "/v1/offers/0CCA44D6-68E9-4762-94EE-31ECE98783B9",
                "method": "GET",
                "headers": []
            },
            "self": {
                "uri": "/subscriptions?key=<key>",
                "method": "GET",
                "headers": []
            }
        },
        "orderId": "6183db3d-6318-4e52-877e-25806e4971be",
        "attributes": {
            "etag": "<etag>",
            "objectType": "Subscription"
        }
    }],
    "attributes": {
        "objectType": "Collection"
    }
}

온라인 서비스 및 소프트웨어를 사용하는 새 상거래 구독에 대한 응답 예제

{
  "totalCount": 2,
  "items": [
    {
      "id": "e669812a-8920-452e-dd39-d5f20d61a1b1",
      "offerId": "CFQ7TTC0LFLZ:0002:CFQ7TTC0MKD5",
      "offerName": "Microsoft 365 E5",
      "friendlyName": "Microsoft 365 E5",
      "productType": {
        "id": "OnlineServicesNCE",
        "displayName": "OnlineServicesNCE"
      },
      "quantity": 1,
      "unitType": "Licenses",
      "hasPurchasableAddons": false,
      "consumptionType": "overage",
      "creationDate": "2023-11-28T22:28:50.7842638Z",
      "effectiveStartDate": "2023-11-28T00:00:00Z",
      "commitmentEndDate": "2023-12-27T00:00:00Z",
      "commitmentEndDateTime": "2023-12-27T23:59:59Z",
      "cancellationAllowedUntilDate": "2023-12-05T22:29:25.9967858Z",
      "billingCycleEndDate": "2023-12-27T00:00:00Z",
      "billingCycleEndDateTime": "2023-12-27T23:59:59Z",
      "status": "active",
      "autoRenewEnabled": true,
      "isTrial": false,
      "billingType": "license",
      "billingCycle": "monthly",
      "termDuration": "P1M",
      "renewalTermDuration": "",
      "refundOptions": [
        {
          "type": "Full",
          "expiresAt": "2023-11-29T22:29:25.9967858Z"
        }
      ],
      "isMicrosoftProduct": true,
      "partnerId": "",
      "attentionNeeded": false,
      "actionTaken": false,
      "contractType": "subscription",
      "links": {
        "product": {
          "uri": "/products/CFQ7TTC0LFLZ?country=US",
          "method": "GET",
          "headers": []
        },
        "sku": {
          "uri": "/products/CFQ7TTC0LFLZ/skus/0002?country=US",
          "method": "GET",
          "headers": []
        },
        "availability": {
          "uri": "/products/CFQ7TTC0LFLZ/skus/0002/availabilities/CFQ7TTC0MKD5?country=US",
          "method": "GET",
          "headers": []
        },
        "self": {
          "uri": "/customers/bfb6b398-c7f5-40f0-aa75-a1f1adf81374/subscriptions/e669812a-8920-452e-dd39-d5f20d61a1b1",
          "method": "GET",
          "headers": []
        }
      },
      "publisherName": "Microsoft Corporation",
      "orderId": "f9a896ba4686",
      "attributes": {
        "objectType": "Subscription"
      }
    },
    {
      "id": "71e8b7b6-ce70-4901-cc72-15042a3230a1",
      "offerId": "DG7GMGF0GJC2:0003:DG7GMGF0CFC5",
      "offerName": "Azure SQL Edge - 1 year",
      "friendlyName": "Azure SQL Edge",
      "productType": {
        "id": "Software",
        "displayName": "Software"
      },
      "quantity": 1,
      "unitType": "Licenses",
      "hasPurchasableAddons": false,
      "creationDate": "2023-11-28T22:21:15.015299Z",
      "effectiveStartDate": "2023-11-28T22:21:12.5336906Z",
      "commitmentEndDate": "2024-11-27T00:00:00Z",
      "commitmentEndDateTime": "2024-11-27T23:59:59Z",
      "cancellationAllowedUntilDate": "2023-12-05T22:21:37.7730547Z",
      "billingCycleEndDate": "2024-11-27T00:00:00Z",
      "billingCycleEndDateTime": "2024-11-27T23:59:59Z",
      "status": "active",
      "autoRenewEnabled": true,
      "isTrial": false,
      "billingType": "license",
      "billingCycle": "annual",
      "termDuration": "P1Y",
      "renewalTermDuration": "",
      "isMicrosoftProduct": true,
      "partnerId": "",
      "attentionNeeded": false,
      "actionTaken": false,
      "contractType": "subscription",
      "links": {
        "product": {
          "uri": "/products/DG7GMGF0GJC2?country=US",
          "method": "GET",
          "headers": []
        },
        "sku": {
          "uri": "/products/DG7GMGF0GJC2/skus/0003?country=US",
          "method": "GET",
          "headers": []
        },
        "availability": {
          "uri": "/products/DG7GMGF0GJC2/skus/0003/availabilities/DG7GMGF0CFC5?country=US",
          "method": "GET",
          "headers": []
        },
        "self": {
          "uri": "/customers/bfb6b398-c7f5-40f0-aa75-a1f1adf81374/subscriptions/71e8b7b6-ce70-4901-cc72-15042a3230a1",
          "method": "GET",
          "headers": []
        }
      },
      "publisherName": "Microsoft",
      "orderId": "be34ac49aefb",
      "attributes": {
        "objectType": "Subscription"
      }
    }
  ]
}