Obtenir des récapitulatifs de facture
S’applique à : Espace partenaires | Espace partenaires géré par 21Vianet | Espace partenaires de Microsoft Cloud for US Government
Vous pouvez utiliser InvoiceSummaries pour récupérer un récapitulatif de facture qui affiche le solde et le total des frais récurrents et ponctuels. La ressource InvoiceSummaries contient un récapitulatif des factures pour chaque type de devise.
Prérequis
Informations d’identification, comme décrit dans Authentification auprès de l’Espace partenaires. Ce scénario prend en charge l’authentification avec les informations d’identification de l’application et de l’utilisateur uniquement.
Identificateur de facture valide.
C#
Pour récupérer une collection InvoiceSummaries qui contient un InvoiceSummary pour chaque type de devise :
Utilisez votre collection IAggregatePartner.Invoices pour appeler la propriété Summaries .
Appelez la méthode Get().
Pour obtenir le solde d’un invoiceSummary individuel, accédez à la propriété BalanceAmount de ce membre de la collection.
// IAggregatePartner scopedPartnerOperations;
// Get the invoice summaries collection.
var invoiceSummaries = scopedPartnerOperations.Invoices.Summaries.Get();
// Display the balance on the first invoice summary in the collection.
Console.Out.WriteLine("Current Account Balance: {0:C}", invoiceSummaries[0].BalanceAmount);
Pour plus d’informations, consultez l’exemple de code suivant :
- Exemple : Application de test de console
- Projet : PartnerSDK.FeatureSample
- Classe : GetInvoiceSummaries.cs
Demande REST
Syntaxe de la requête
Méthode | URI de requête |
---|---|
GET | {baseURL}/v1/invoices/summaries HTTP/1.1 |
Paramètre d’URI
Aucun.
En-têtes de requête
Pour plus d’informations, consultez En-têtes REST de l’Espace Partenaires.
Corps de demande
Aucun.
Exemple de requête
GET https://api.partnercenter.microsoft.com/v1/invoices/summaries HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: a45e6643-1caf-4429-8f90-07c03d85bc2b
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
Connection: Keep-Alive
Réponse REST
Si elle réussit, cette méthode renvoie une ressource InvoiceSummaries dans le corps de la réponse.
Codes d’erreur et de réussite de la réponse
Chaque réponse est accompagnée d’un code d’état HTTP qui indique la réussite ou l’échec ainsi que des informations de débogage supplémentaires. Utilisez un outil de trace réseau pour lire ce code, le type d’erreur et des paramètres supplémentaires. Pour obtenir la liste complète, consultez Codes d’erreur.
Exemple de réponse
HTTP/1.1 200 OK
Content-Length: 256
Content-Type: application/json; charset=utf-8
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-RequestId: a45e6643-1caf-4429-8f90-07c03d85bc2b
Date: Thu, 24 Mar 2016 05:21:01 GMT
{
"totalCount": 3,
"items": [
{
"balanceAmount": 751094.39,
"currencyCode": "GBP",
"currencySymbol": "£",
"accountingDate": "2018-03-16T00:00:00",
"firstInvoiceCreationDate": "2017-01-21T00:00:00Z",
"lastPaymentDate": "2017-01-01T12:00:00Z",
"lastPaymentAmount": 1000,
"latestInvoiceDate": "2018-03-16T00:00:00",
"details": [
{
"invoiceType": "Recurring",
"summary": {
"balanceAmount": 202955.87,
"currencyCode": "GBP",
"currencySymbol": "£",
"accountingDate": "2017-02-27T00:00:00Z",
"firstInvoiceCreationDate": "2017-01-21T00:00:00Z",
"lastPaymentDate": "2017-01-01T12:00:00Z",
"lastPaymentAmount": 1000,
"latestInvoiceDate": "0001-01-01T00:00:00",
"attributes": {
"objectType": "InvoiceSummary"
}
}
},
{
"invoiceType": "OneTime",
"summary": {
"balanceAmount": 548138.52,
"currencyCode": "GBP",
"currencySymbol": "£",
"accountingDate": "2018-03-16T00:00:00",
"firstInvoiceCreationDate": "2018-03-16T00:00:00",
"lastPaymentDate": "0001-01-01T00:00:00",
"lastPaymentAmount": 0,
"latestInvoiceDate": "2018-03-16T00:00:00",
"attributes": {
"objectType": "InvoiceSummary"
}
}
}
],
"links": {
"self": {
"uri": "/invoices/summary",
"method": "GET",
"headers": []
}
},
"attributes": {
"objectType": "InvoiceSummary"
}
},
{
"balanceAmount": 1230.33,
"currencyCode": "CHF",
"currencySymbol": "CHF",
"accountingDate": "2018-03-16T00:00:00",
"firstInvoiceCreationDate": "2018-03-16T00:00:00",
"lastPaymentDate": "0001-01-01T00:00:00",
"lastPaymentAmount": 0,
"latestInvoiceDate": "2018-03-16T00:00:00",
"details": [
{
"invoiceType": "OneTime",
"summary": {
"balanceAmount": 1230.33,
"currencyCode": "CHF",
"currencySymbol": "CHF",
"accountingDate": "2018-03-16T00:00:00",
"firstInvoiceCreationDate": "2018-03-16T00:00:00",
"lastPaymentDate": "0001-01-01T00:00:00",
"lastPaymentAmount": 0,
"latestInvoiceDate": "2018-03-16T00:00:00",
"attributes": {
"objectType": "InvoiceSummary"
}
}
}
],
"links": {
"self": {
"uri": "/invoices/summary",
"method": "GET",
"headers": []
}
},
"attributes": {
"objectType": "InvoiceSummary"
}
},
{
"balanceAmount": 1001.12,
"currencyCode": "EUR",
"currencySymbol": "€",
"accountingDate": "2018-03-16T00:00:00",
"firstInvoiceCreationDate": "2018-03-16T00:00:00",
"lastPaymentDate": "0001-01-01T00:00:00",
"lastPaymentAmount": 0,
"latestInvoiceDate": "2018-03-16T00:00:00",
"details": [
{
"invoiceType": "OneTime",
"summary": {
"balanceAmount": 1001.12,
"currencyCode": "EUR",
"currencySymbol": "€",
"accountingDate": "2018-03-16T00:00:00",
"firstInvoiceCreationDate": "2018-03-16T00:00:00",
"lastPaymentDate": "0001-01-01T00:00:00",
"lastPaymentAmount": 0,
"latestInvoiceDate": "2018-03-16T00:00:00",
"attributes": {
"objectType": "InvoiceSummary"
}
}
}
],
"links": {
"self": {
"uri": "/invoices/summary",
"method": "GET",
"headers": []
}
},
"attributes": {
"objectType": "InvoiceSummary"
}
}
],
"links": {
"self": {
"uri": "/invoices/summaries",
"method": "GET",
"headers": []
}
},
"attributes": {
"objectType": "Collection"
}
}