청구서에 청구되지 않은 상업용 사용 품목 가져오기

참고 항목

2024년 9월 30일 이후에는 이 API가 더 이상 작동하지 않습니다. 정보를 사용하여 버전을 선택하고 미리 계획합니다.

  • 현재 및 이전 청구 기간에 대한 청구되지 않은 일일 사용량 세부 정보에 액세스하려면 이 API를 사용합니다. 해당 날짜 이전에 v2 GA로 전환하지 않는 한 2024년 9월 30일까지 사용할 수 있습니다.
  • 현재 및 이전 기간에 대한 청구되지 않은 일일 등급 사용량을 얻으려면 2024년 9월 30일까지 API v2 GA로 전환합니다.

API v2 마이그레이션 단계의 경우 다음으로 이동합니다.

청구 및 청구되지 않은 일일 등급 사용량 조정 API v2(GA)

청구되지 않은 상용 소비 품목 세부 정보 컬렉션을 가져오는 방법.

다음 메서드를 사용하여 프로그래밍 방식으로 청구되지 않은 상업용 소비 품목(개방형 사용 품목이라고도 함)의 세부 정보 컬렉션을 가져올 수 있습니다.

Important

일일 등급 사용량 데이터에는 다음 제품에 대한 요금이 포함되지 않습니다.

  • Azure 예약
  • Azure 절약 플랜
  • Office
  • Dynamics
  • Microsoft Power Apps
  • 영구 소프트웨어
  • 소프트웨어 구독
  • Marketplace SaaS 제품

참고 항목

API 또는 파트너 센터 포털을 통해 매일 청구되지 않은 사용량 현황 데이터를 검색할 수 있습니다. 데이터를 사용할 수 있게 되는 데 최대 24시간이 걸릴 수 있습니다. 그러나 위치 및 미터가 사용량을 보고하는 시기에 따라 추가 지연이 있을 수 있습니다.

경우에 따라 이전 달의 청구된 사용량 현황 데이터가 배달될 때까지 가장 최근의 청구되지 않은 사용량 현황 데이터가 표시되지 않을 수 있습니다. 이는 청구된 사용량 현황 데이터가 합의된 시간 내에 전달되도록 하기 위해 수행됩니다. 청구된 사용량 현황 데이터를 받으면 월 시작부터 업데이트된 모든 청구되지 않은 사용 현황 데이터를 검색할 수 있습니다.

필수 조건

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

C#

지정된 청구서의 품목을 가져오려면 다음을 수행합니다.

  1. ById 메서드를 호출하여 지정된 청구서에 대한 청구서 작업에 대한 인터페이스를 가져옵니다.
  2. Get 또는 GetAsync 메서드를 호출하여 청구서 개체를 검색합니다.

청구서 개체에는 지정된 청구서에 대한 모든 정보가 포함됩니다. 공급자청구되지 않은 세부 정보(예: OneTime)의 원본을 식별합니다. InvoiceLineItemType형식(예: UsageLineItem)을 지정합니다.

다음 예제 코드는 foreach 루프를 사용하여 InvoiceLineItems 컬렉션을 처리합니다. 각 InvoiceLineItemType에 대해 별도의 품목 컬렉션이 검색됩니다.

InvoiceDetail 인스턴스에 해당하는 품목 컬렉션을 가져오려면 다음을 수행합니다.

  1. 인스턴스의 BillingProviderInvoiceLineItemType을 By 메서드에 전달합니다.
  2. Get 또는 GetAsync 메서드를 호출하여 연결된 품목을 검색합니다.
  3. 다음 예제와 같이 컬렉션을 트래버스하는 열거자를 만듭니다.
// IAggregatePartner partnerOperations;
// string curencyCode;
// string period;
// int pageMaxSizeReconLineItems = 2000;

// 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()));

var seekBasedResourceCollection = scopedPartnerOperations.Invoices.ById("unbilled").By("onetime", "usagelineitems", curencyCode, period, pageMaxSizeReconLineItems).Get();

var fetchNext = true;

ConsoleKeyInfo keyInfo;

var itemNumber = 1;
while (fetchNext)
{
    Console.Out.WriteLine("\tLine items count: " + seekBasedResourceCollection.Items.Count());

    seekBasedResourceCollection.Items.ToList().ForEach(item =>
    {
        // Instance of type DailyRatedUsageLineItem
        if (item is DailyRatedUsageLineItem)
        {
            Type t = typeof(DailyRatedUsageLineItem);
            PropertyInfo[] properties = t.GetProperties();

            foreach (PropertyInfo property in properties)
            {
                // Insert code here to work with the line item properties
            }
        }
        itemNumber++;
    });

    Console.Out.WriteLine("\tPress any key to fetch next data. Press the Escape (Esc) key to quit: \n");
    keyInfo = Console.ReadKey();

    if (keyInfo.Key == ConsoleKey.Escape)
    {
        break;
    }

    fetchNext = !string.IsNullOrWhiteSpace(seekBasedResourceCollection.ContinuationToken);

    if (fetchNext)
    {
        if (seekBasedResourceCollection.Links.Next.Headers != null && seekBasedResourceCollection.Links.Next.Headers.Any())
        {
            seekBasedResourceCollection = scopedPartnerOperations.Invoices.ById("unbilled").By("onetime", "usagelineitems", curencyCode, period, pageMaxSizeReconLineItems).Seek(seekBasedResourceCollection.ContinuationToken, SeekOperation.Next);
        }
    }
}

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

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

REST 요청

요청 구문

사용 사례에 따라 REST 요청에 다음 구문을 사용할 수 있습니다. 자세한 내용은 각 구문에 대한 설명을 참조하세요.

메서드 요청 URI 구문 사용 사례에 대한 설명
GET {baseURL}/v1/invoices/unbilled/lineitems?provider=onetime&invoicelineitemtype=usagelineitems¤cycode={currencycode}&period={period} HTTP/1.1 이 구문을 사용하여 지정된 청구서에 대한 모든 품목의 전체 목록을 반환합니다.
GET {baseURL}/v1/invoices/unbilled/lineitems?provider=onetime&invoicelineitemtype=usagelineitems¤cycode={currencycode}&period={period}&size={size} HTTP/1.1 큰 청구서에 이 구문을 사용합니다. 지정한 크기와 0부터 시작하는 오프셋을 사용하여 페이지가 지정된 줄 항목 목록을 반환합니다.
GET {baseURL}/v1/invoices/unbilled/lineitems?provider=onetime&invoicelineitemtype=usagelineitems¤cycode={currencycode}&period={period}&size={size}&seekOperation=Next 이 구문을 사용하여 조정 항목 seekOperation = "Next"의 다음 페이지를 가져옵니다.

URI 매개 변수

요청을 만들 때 다음 URI 및 쿼리 매개 변수를 사용합니다.

속성 Type 필수 설명
provider string 공급자: "OneTime".
invoice-line-item-type string 청구서 세부 정보 유형: "UsageLineItems", "UsageLineItems".
currencyCode string 청구되지 않은 품목의 통화 코드입니다.
기간 string 청구되지 않은 정찰의 기간입니다(예: 현재, 이전). 1월에 청구 주기(01/01/2020 – 01/31/2020)의 청구되지 않은 사용량 현황 데이터를 쿼리하고 기간을 "현재", 다른 "이전"으로 선택해야 한다고 가정합니다.
size 번호 아니요 반환할 항목의 최대 수입니다. 기본 크기는 2000입니다.
seekOperation string 아니요 조정 품목의 다음 페이지를 가져오도록 설정합니다 seekOperation=Next .

요청 헤더

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

요청 본문

없음

REST 응답

성공하면 응답에 품목 세부 정보 컬렉션이 포함됩니다.

품목 ChargeType의 경우 구매이 새로 만들기에 매핑되고 환불이 Cancel매핑됩니다.

응답 성공 및 오류 코드

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

요청-응답 예제

요청-응답 예제 1

다음 세부 정보가 이 예제에 적용됩니다.

  • 공급자: OneTime
  • InvoiceLineItemType: UsageLineItems
  • 기간: 이전

요청 예제 1

GET https://api.partnercenter.microsoft.com/v1//invoices/unbilled/lineitems?provider=onetime&invoicelineitemtype=usagelineitems&currencycode=usd&period=previous&size=2000 HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 1234ecb8-37af-45f4-a1a1-358de3ca2b9e
MS-CorrelationId: 5e612512-4345-4bb0-866e-47aeda031234
X-Locale: en-US
MS-PartnerCenter-Application: Partner Center .NET SDK Samples
Host: api.partnercenter.microsoft.com

Important

2023년 6월 현재 최신 파트너 센터 .NET SDK 릴리스 3.4.0이 보관됩니다. 유용한 정보가 포함된 추가 정보 파일함께 GitHub에서 SDK 릴리스를 다운로드할 수 있습니다.

파트너는 파트너 센터 REST API를 계속 사용하는 것이 좋습니다.

응답 예제 1

HTTP/1.1 200 OK
Content-Length: 2484
Content-Type: application/json; charset=utf-8
MS-CorrelationId: 5e612512-4345-4bb0-866e-47aeda031234
MS-RequestId: 1234ecb8-37af-45f4-a1a1-358de3ca2b9e
MS-CV: bpqyomePDUqrSSYC.0
MS-ServerId: 202010406
Date: Wed, 20 Feb 2019 19:59:27 GMT

{
    "totalCount": 2,
    "items": [
        {
            "partnerId": "00083575-bbd0-54de-b2ad-0f5b0e927d71",
            "partnerName": "MTBC",
            "customerId": "",
            "customerName": "",
            "customerDomainName": "",
            "invoiceNumber": "",
            "productId": "",
            "skuId": "",
            "availabilityId": "",
            "skuName": "VM-Series Next-Generation Firewall (Bundle 2 PAYG)",
            "productName": "VM-Series Next Generation Firewall",
            "publisherName": "Test Alto Networks, Inc.",
            "publisherId": "",
            "subscriptionId": "12345678-04d9-421c-baf8-e3b8dd62ddba",
            "subscriptionDescription": "Pay-As-You-Go",
            "chargeStartDate": "2019-01-01T00:00:00Z",
            "chargeEndDate": "2019-02-01T00:00:00Z",
            "usageDate": "2019-01-01T00:00:00Z",
            "meterType": "1 Compute Hour - 4core",
            "meterCategory": "Virtual Machine Licenses",
            "meterId": "4core",
            "meterSubCategory": "VM-Series Next Generation Firewall",
            "meterName": "VM-Series Next Generation Firewall - VM-Series Next-Generation Firewall (Bundle 2 PAYG) - 4 Core Hours",
            "meterRegion": "",
            "unitOfMeasure": "1 Hour",
            "resourceLocation": "EASTUS",
            "consumedService": "Microsoft.Compute",
            "resourceGroup": "ECH-PAN-RG",
            "resourceUri": "/subscriptions/12345678-04d9-421c-baf8-e3b8dd62ddba/resourceGroups/ECH-PAN-RG/providers/Microsoft.Compute/virtualMachines/echpanfw",
            "tags": "",
            "additionalInfo": "{  \"ImageType\": null,  \"ServiceType\": \"Standard_D3_v2\",  \"VMName\": null,  \"VMProperties\": null,  \"UsageType\": \"ComputeHR_SW\"}",
            "serviceInfo1": "",
            "serviceInfo2": "",
            "customerCountry": "",
            "mpnId": "1234567",
            "resellerMpnId": "",
            "chargeType": "",
            "unitPrice": 1.2799888920023,
            "quantity": 24.0,
            "unitType": "",
            "billingPreTaxTotal": 30.7197334080551,
            "billingCurrency": "USD",
            "pricingPreTaxTotal": 30.7197334080551,
            "pricingCurrency": "USD",
            "entitlementId": "3f47bcf1-965d-40a1-a2bc-3d5db3653250",
            "entitlementDescription": "Partner Subscription",
            "pcToBCExchangeRate": 1,
            "pcToBCExchangeRateDate": "2019-08-01T00:00:00Z",
            "effectiveUnitPrice": 0,
            "rateOfPartnerEarnedCredit": 0,
            "rateOfCredit": 0,
            "creditType": "Credit Not Applied",
            "invoiceLineItemType": "usage_line_items",
            "billingProvider": "marketplace",
        "benefitOrderId": "5ea053d6-4a0d-46ef-bc82-15065b475d01",
        "benefitId": "28ddab06-2c5b-479e-88bb-7b7bfda4e7fd",
        "benefitType": "SavingsPlan",
            "attributes": {
                "objectType": "DailyRatedUsageLineItem"
            }
         },
         {
            "partnerId": "00083575-bbd0-54de-b2ad-0f5b0e927d71",
            "partnerName": "MTBC",
            "customerId": "",
            "customerName": "",
            "customerDomainName": "",
            "invoiceNumber": "",
            "productId": "",
            "skuId": "",
            "availabilityId": "",
            "skuName": "VM-Series Next-Generation Firewall (Bundle 2 PAYG)",
            "productName": "VM-Series Next Generation Firewall",
            "publisherName": "Test Alto Networks, Inc.",
            "publisherId": "",
            "subscriptionId": "12345678-04d9-421c-baf8-e3b8dd62ddba",
            "subscriptionDescription": "Pay-As-You-Go",
            "chargeStartDate": "2019-01-01T00:00:00Z",
            "chargeEndDate": "2019-02-01T00:00:00Z",
            "usageDate": "2019-01-02T00:00:00Z",
            "meterType": "1 Compute Hour - 4core",
            "meterCategory": "Virtual Machine Licenses",
            "meterId": "4core",
            "meterSubCategory": "VM-Series Next Generation Firewall",
            "meterName": "VM-Series Next Generation Firewall - VM-Series Next-Generation Firewall (Bundle 2 PAYG) - 4 Core Hours",
            "meterRegion": "",
            "unitOfMeasure": "1 Hour",
            "resourceLocation": "EASTUS",
            "consumedService": "Microsoft.Compute",
            "resourceGroup": "ECH-PAN-RG",
            "resourceUri": "/subscriptions/12345678-04d9-421c-baf8-e3b8dd62ddba/resourceGroups/ECH-PAN-RG/providers/Microsoft.Compute/virtualMachines/echpanfw",
            "tags": "",
            "additionalInfo": "{  \"ImageType\": null,  \"ServiceType\": \"Standard_D3_v2\",  \"VMName\": null,  \"VMProperties\": null,  \"UsageType\": \"ComputeHR_SW\"}",
            "serviceInfo1": "",
            "serviceInfo2": "",
            "customerCountry": "",
            "mpnId": "1234567",
            "resellerMpnId": "",
            "chargeType": "",
            "unitPrice": 1.2799888920023,
            "quantity": 24.0,
            "unitType": "",
            "billingPreTaxTotal": 30.7197334080551,
            "billingCurrency": "USD",
            "pricingPreTaxTotal": 30.7197334080551,
            "pricingCurrency": "USD",
            "entitlementId": "31cdf47f-b249-4edd-9319-637862d12345",
            "entitlementDescription": "Partner Subscription",
            "pcToBCExchangeRate": 1,
            "pcToBCExchangeRateDate": "2019-08-01T00:00:00Z",
            "effectiveUnitPrice": 0,
            "rateOfPartnerEarnedCredit": 0,
            "rateOfCredit": 1,
            "creditType": "Azure Credit Applied",
            "invoiceLineItemTypce": "usage_line_items",
            "billingProvider": "marketplace",
        "benefitOrderId": "",
            "benefitId": "",
            "benefitType": "Charge",
            "attributes": {
                "objectType": "DailyRatedUsageLineItem"
            }
        }
    ],
    "links": {
        "self": {
            "uri": "/invoices/unbilled/lineitems?provider=onetime&invoicelineitemtype=usagelineitems&currencycode=usd&period=previous&size=2000",
            "method": "GET",
            "headers": []
        },
        "next": {
            "uri": "/invoices/unbilled/lineitems?provider=onetime&invoicelineitemtype=usagelineitems&currencycode=usd&period=previous&size=2000&seekOperation=Next",
            "method": "GET",
            "headers": [
                {
                    "key": "MS-ContinuationToken",
                    "value": "AQAAAA=="
                }
            ]
        }
    },
    "attributes": {
        "objectType": "Collection"
    }
}

요청-응답 예제 2

다음 세부 정보가 이 예제에 적용됩니다.

  • 공급자: OneTime
  • InvoiceLineItemType: UsageLineItems
  • 기간: 이전
  • SeekOperation: 다음

요청 예제 2

GET https://api.partnercenter.microsoft.com/v1/invoices/unbilled/lineitems?provider=onetime&invoiceLineItemType=usagelineitems&currencyCode=usd&period=previous&size=2000&seekoperation=next HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-ContinuationToken: d19617b8-fbe5-4684-a5d8-0230972fb0cf,0705c4a9-39f7-4261-ba6d-53e24a9ce47d_a4ayc/80/OGda4BO/1o/V0etpOqiLx1JwB5S3beHW0s=,0d81c700-98b4-4b13-9129-ffd5620f72e7
MS-RequestId: 1234ecb8-37af-45f4-a1a1-358de3ca2b9e
MS-CorrelationId: 5e612512-4345-4bb0-866e-47aeda031234
X-Locale: en-US
MS-PartnerCenter-Application: Partner Center .NET SDK Samples
Host: api.partnercenter.microsoft.com

응답 예제 2

HTTP/1.1 200 OK
Content-Length: 2484
Content-Type: application/json; charset=utf-8
MS-CorrelationId: 5e612512-4345-4bb0-866e-47aeda031234
MS-RequestId: 1234ecb8-37af-45f4-a1a1-358de3ca2b9e
MS-CV: bpqyomePDUqrSSYC.0
MS-ServerId: 202010406
Date: Wed, 20 Feb 2019 19:59:27 GMT

{
    "totalCount": 1,
    "items": [
        {
            "partnerId": "00083575-bbd0-54de-b2ad-0f5b0e927d71",
            "partnerName": "MTBC",
            "customerId": "",
            "customerName": "",
            "customerDomainName": "",
            "invoiceNumber": "",
            "productId": "",
            "skuId": "",
            "availabilityId": "",
            "skuName": "VM-Series Next-Generation Firewall (Bundle 2 PAYG)",
            "productName": "VM-Series Next Generation Firewall",
            "publisherName": "Test Alto Networks, Inc.",
            "publisherId": "",
            "subscriptionId": "12345678-04d9-421c-baf8-e3b8dd62ddba",
            "subscriptionDescription": "Pay-As-You-Go",
            "chargeStartDate": "2019-01-01T00:00:00Z",
            "chargeEndDate": "2019-02-01T00:00:00Z",
            "usageDate": "2019-01-02T00:00:00Z",
            "meterType": "1 Compute Hour - 4core",
            "meterCategory": "Virtual Machine Licenses",
            "meterId": "4core",
            "meterSubCategory": "VM-Series Next Generation Firewall",
            "meterName": "VM-Series Next Generation Firewall - VM-Series Next-Generation Firewall (Bundle 2 PAYG) - 4 Core Hours",
            "meterRegion": "",
            "unitOfMeasure": "1 Hour",
            "resourceLocation": "EASTUS",
            "consumedService": "Microsoft.Compute",
            "resourceGroup": "ECH-PAN-RG",
            "resourceUri": "/subscriptions/12345678-04d9-421c-baf8-e3b8dd62ddba/resourceGroups/ECH-PAN-RG/providers/Microsoft.Compute/virtualMachines/echpanfw",
            "tags": "",
            "additionalInfo": "{  \"ImageType\": null,  \"ServiceType\": \"Standard_D3_v2\",  \"VMName\": null,  \"VMProperties\": null,  \"UsageType\": \"ComputeHR_SW\"}",
            "serviceInfo1": "",
            "serviceInfo2": "",
            "customerCountry": "",
            "mpnId": "1234567",
            "resellerMpnId": "",
            "chargeType": "",
            "unitPrice": 1.2799888920023,
            "quantity": 24.0,
            "unitType": "",
            "billingPreTaxTotal": 30.7197334080551,
            "billingCurrency": "USD",
            "pricingPreTaxTotal": 30.7197334080551,
            "pricingCurrency": "USD",
            "entitlementId": "31cdf47f-b249-4edd-9319-637862d8c0b4",
            "entitlementDescription": "Partner Subscription",
            "pcToBCExchangeRate": 1,
            "pcToBCExchangeRateDate": "2019-08-01T00:00:00Z",
            "effectiveUnitPrice": 0,
            "rateOfPartnerEarnedCredit": 0.15,
            "rateOfCredit": 0.15,
            "creditType": "Partner Earned Credit Applied",
            "invoiceLineItemType": "usage_line_items",
            "billingProvider": "marketplace",
        "benefitOrderId": "",
            "benefitId": "",
            "benefitType": "Charge",
            "attributes": {
                "objectType": "DailyRatedUsageLineItem"
            }
        }
    ],
    "links": {
        "self": {
             "uri": "/invoices/unbilled/lineitems?provider=onetime&invoicelineitemtype=usagelineitems&currencycode=usd&period=previous&size=2000",
            "method": "GET",
            "headers": []
        }
    },
    "attributes": {
        "objectType": "Collection"
    }
}