Condividi tramite


Ottenere le sottoscrizioni di un cliente

si applica a: Centro per i partner | Centro per i partner gestito da 21Vianet | Centro per i partner per Microsoft Cloud per il governo degli Stati Uniti

Come ottenere una raccolta di sottoscrizioni di un cliente.

Prerequisiti

  • Credenziali descritte in autenticazione del Centro per Partner. Questo scenario supporta l'autenticazione con le credenziali App autonome e App+Utente.

  • ID del cliente (customer-tenant-id). Se non si conosce l'ID del cliente, è possibile cercarlo in Centro per i partner selezionando l'area di lavoro clienti, quindi il cliente dall'elenco dei clienti, quindi Account. Nella pagina Account del cliente, cercare l'ID Microsoft nella sezione informazioni sull'account cliente. L'ID Microsoft corrisponde all'ID cliente (customer-tenant-id).

C#

Per ottenere un elenco di tutte le sottoscrizioni di un cliente, usare prima di tutto il metodo IAggregatePartner.Customers.ById con l'identificatore del cliente per identificare il cliente. Usare quindi la proprietà Sottoscrizioni per recuperare un'interfaccia per le operazioni di raccolta delle sottoscrizioni. Infine, chiamare i metodi Get o GetAsync per recuperare la raccolta di sottoscrizioni del cliente.

// IAggregatePartner partnerOperations;
// string customerId;

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

Esempio: app di test della console . Progetto: Esempi di SDK del Centro per i Partner Classe: GetSubscriptions.cs

Richiesta REST

Sintassi della richiesta

Metodo URI della richiesta
OTTIENI {baseURL}/v1/customers/{customer-tenant-id}/subscriptions HTTP/1.1

Parametro URI

Questa tabella elenca il parametro di query necessario per ottenere tutte le sottoscrizioni.

Nome Digitare Obbligatorio Descrizione
ID cliente-locatore corda Stringa in formato GUID che identifica il cliente.

Intestazioni della richiesta

Per ulteriori informazioni, vedere intestazioni REST del Partner Center.

Corpo della richiesta

Nessuno.

Esempio di richiesta

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: aaaa0000-bb11-2222-33cc-444444dddddd
Connection: Keep-Alive

Risposta REST

In caso di esito positivo, questo metodo restituisce una raccolta di risorse Subscription nel corpo della risposta.

Codici di errore e esito positivo della risposta

Ogni risposta viene fornita con un codice di stato HTTP che indica l'esito positivo o negativo e altre informazioni di debug. Usare uno strumento di traccia di rete per leggere il codice, il tipo di errore e i parametri aggiuntivi. Per l'elenco completo, vedere codici di errore REST del Centro partner.

Esempi di risposta

Esempio di risposta per una sottoscrizione di servizi online legacy

HTTP/1.1 200 OK
Content-Length: 73754
Content-Type: application/json
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
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"
    }
}

Esempio di risposta per le nuove sottoscrizioni commerciali con servizi online e software

{
  "totalCount": 2,
  "items": [
    {
      "id": "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
      "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/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
          "method": "GET",
          "headers": []
        }
      },
      "publisherName": "Microsoft Corporation",
      "orderId": "f9a896ba4686",
      "attributes": {
        "objectType": "Subscription"
      }
    },
    {
      "id": "bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f",
      "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/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f",
          "method": "GET",
          "headers": []
        }
      },
      "publisherName": "Microsoft",
      "orderId": "be34ac49aefb",
      "attributes": {
        "objectType": "Subscription"
      }
    }
  ]
}