Mendapatkan faktur berdasarkan ID

Berlaku untuk: Pusat Mitra | Pusat Mitra yang dioperasikan oleh 21Vianet | Pusat Mitra untuk Microsoft Cloud for US Government

Mengambil faktur tertentu menggunakan ID faktur.

Prasyarat

  • Kredensial seperti yang dijelaskan dalam autentikasi Pusat Mitra. Skenario ini hanya mendukung autentikasi dengan kredensial App+User.

  • ID Faktur yang valid.

C#

Untuk mendapatkan faktur berdasarkan ID:

  1. Gunakan koleksi IPartner.Invoices Anda dan panggil metode ById().

  2. Panggil metode Get() atau GetAsync().

// IPartner scopedPartnerOperations;
// string selectedInvoiceId;

var invoice = scopedPartnerOperations.Invoices.ById(selectedInvoiceId).Get();

Sampel: Aplikasi pengujian konsol. Proyek: Kelas PartnerSDK.FeatureSample: GetInvoice.cs

Permintaan REST

Minta sintaks

Metode URI Permintaan
GET {baseURL}/v1/invoices/{invoice-id} HTTP/1.1

Parameter URI

Gunakan parameter kueri berikut untuk mendapatkan faktur.

Nama Jenis Diperlukan Deskripsi
id faktur string Ya Nilainya adalah id faktur yang memungkinkan penjual memfilter hasil untuk faktur tertentu.

Header permintaan

Untuk informasi selengkapnya, lihat Header REST Pusat Mitra.

Isi permintaan

Tidak ada

Contoh permintaan

GET https://api.partnercenter.microsoft.com/v1/invoices/<invoice-id> HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 8ac25aa5-9537-4b6d-b782-aa0c8e979e99
MS-CorrelationId: 57eb2ca7-755f-450f-9187-eae1e75a0114

Respons REST

Jika berhasil, metode ini mengembalikan sumber daya Faktur di isi respons.

Respons keberhasilan dan kode kesalahan

Setiap respons dilengkapi dengan kode status HTTP yang menunjukkan keberhasilan atau kegagalan dan informasi penelusuran kesalahan tambahan. Gunakan alat pelacakan jaringan untuk membaca kode ini, jenis kesalahan, dan parameter tambahan. Untuk daftar lengkapnya, lihat Kode Kesalahan.

Contoh respons

HTTP/1.1 200 OK
Content-Length: 676
Content-Type: application/json; charset=utf-8
MS-CorrelationId: 57eb2ca7-755f-450f-9187-eae1e75a0114
MS-RequestId: 8ac25aa5-9537-4b6d-b782-aa0c8e979e99
Date: Thu, 24 Mar 2016 05:22:14 GMT

{
    "id": "G000024135",
    "invoiceDate": "2018-02-08T22:40:37.5897767Z",
    "billingPeriodStartDate": "2018-02-01T22:40:37.5897767Z",
    "billingPeriodEndDate": "2018-02-28T22:40:37.5897767Z",
    "totalCharges": 2076.63,
    "paidAmount": 0,
    "currencyCode": "USD",
    "currencySymbol": "$",
    "pdfDownloadLink": "/invoices/G000024135/documents/statement",
    "taxReceipts": [
        {
            "id": "123456",
            "taxReceiptPdfDownloadLink": "/invoices/G000024135/receipts/123456/documents/statement"
        }
    ],
    "invoiceDetails": [
        {
            "invoiceLineItemType": "billing_line_items",
            "billingProvider": "one_time",
            "links": {
                "self": {
                    "uri": "/invoices/OneTime-G000024135/lineitems/OneTime/BillingLineItems",
                    "method": "GET",
                    "headers": []
                }
            },
            "attributes": {
                "objectType": "InvoiceDetail"
            }
        }
    ],
    "documentType": "invoice",
    "invoiceType": "OneTime",
    "links": {
        "self": {
            "uri": "/invoices/OneTime-G000024135",
            "method": "GET",
            "headers": []
        }
    },
    "attributes": {
        "objectType": "Invoice"
    }
}