Ottenere un elenco di sottoscrizioni in base all'ordine
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
Ottiene una raccolta di risorse Subscription che corrispondono a un determinato ordine.
Prerequisiti
Credenziali come descritto in Partner Center autenticazione. Questo scenario supporta l'autenticazione sia con le credenziali dell'app autonoma che con quelle App+Utente.
ID 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 il ID Microsoft nella sezione Informazioni sull'account cliente. L'ID Microsoft corrisponde all'ID cliente (customer-tenant-id
).Un ID ordine.
C#
Per ottenere un elenco di sottoscrizioni in base all'ordine, usare la raccolta IAggregatePartner.Customers e chiamare il metodo ById(). Quindi, chiamare la proprietà Subscriptions, seguita dal metodo ByOrder(). Completare chiamando Get() o GetAsync().
// IAggregatePartner partnerOperations;
// var selectedCustomerId as string;
// string orderID;
ResourceCollection<Subscription> customerSubscriptions = partnerOperations.Customers.ById(selectedCustomerId).Subscriptions.ByOrder(orderID).Get();
di esempio: app di test della console. Project: PartnerSDK.FeatureSample Class: SubscriptionsByOrder.cs
Richiesta REST
Sintassi della richiesta
Metodo | URI della richiesta |
---|---|
GET | {baseURL}/v1/customers/{customer-tenant-id}/subscriptions?order_id={id-for-order} HTTP/1.1 |
Parametro URI
Questa tabella elenca il parametro di query necessario per ottenere tutte le sottoscrizioni.
Nome | Digitare | Obbligatorio | Descrizione |
---|---|---|---|
customer-tenant-id | guid | Y | Un GUID corrispondente al cliente. |
id-for-order | guid | Y | Un GUID corrispondente all'ordine. |
Intestazioni della richiesta
Per ulteriori informazioni, vedere le Intestazioni REST del Centro per i Partner .
Corpo della richiesta
Nessuno.
Esempio di richiesta
GET https://api.partnercenter.microsoft.com/v1/customers/{customer-tenant-id}/subscriptions?order_id={id-for-order} HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 16fee928-dc2c-412f-adbb-871f68babf16
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 .
Esempio di risposta
HTTP/1.1 200 OK
Content-Length: 73754
Content-Type: application/json
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-RequestId: 16fee928-dc2c-412f-adbb-871f68babf16
Date: Wed, 25 Nov 2015 05:50:45 GMT
{
"totalCount": 1,
"items": [{
"id": "83ef9d05-4169-4ef9-9657-0e86b1eab1de",
"entitlementId": "a356ac8c-e310-44f4-bf85-C7f29044af99",
"friendlyName": "Myofferpurchase",
"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": "{id-for-order}",
"attributes": {
"etag": "<etag>",
"objectType": "Subscription"
}
}],
"attributes": {
"objectType": "Collection"
}
}
Esempio di risposta nel nuovo commercio
GET https://api.partnercenter.microsoft.com/v1/customers/c501c3c4-d776-40ef-9ecf-9cefb59442c1//subscriptions?order_id=79d9f5e2f43a HTTP/1.1
Content-Length: 73754
Content-Type: application/json
MS-RequestId: 261a7eab-99ba-4fef-b3f1-476ebfddfa52
MS-CorrelationId: bbbb1111-cc22-3333-44dd-555555eeeeee
Date: Thurs, 6 June 2024 10:50:45 GMT
{
"totalCount": 1,
"items": [
{
"id": "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
"offerId": "CFQ7TTC0LH18:0001:CFQ7TTC0P0WS",
"offerName": "Microsoft 365 Business Basic",
"friendlyName": "Microsoft 365 Business Basic",
"productType": {
"id": "OnlineServicesNCE",
"displayName": "OnlineServicesNCE"
},
"quantity": 2,
"unitType": "Licenses",
"hasPurchasableAddons": false,
"creationDate": "2024-06-05T19:26:38.3667635Z",
"effectiveStartDate": "2024-06-05T00:00:00Z",
"commitmentEndDate": "2024-07-04T00:00:00Z",
"commitmentEndDateTime": "2024-07-04T23:59:59Z",
"cancellationAllowedUntilDate": "2024-06-12T19:27:03.440527Z",
"billingCycleEndDate": "2024-07-04T00:00:00Z",
"billingCycleEndDateTime": "2024-07-04T23:59:59Z",
"status": "active",
"autoRenewEnabled": true,
"isTrial": false,
"billingType": "license",
"billingCycle": "monthly",
"termDuration": "P1M",
"renewalTermDuration": "",
"isMicrosoftProduct": true,
"partnerId": "4847383",
"attentionNeeded": false,
"actionTaken": false,
"contractType": "subscription",
"links": {
"product": {
"uri": "/products/CFQ7TTC0LH18?country=US",
"method": "GET",
"headers": []
},
"sku": {
"uri": "/products/CFQ7TTC0LH18/skus/0001?country=US",
"method": "GET",
"headers": []
},
"availability": {
"uri": "/products/CFQ7TTC0LH18/skus/0001/availabilities/CFQ7TTC0P0WS?country=US",
"method": "GET",
"headers": []
},
"self": {
"uri": "/customers/c501c3c4-d776-40ef-9ecf-9cefb59442c1/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
"method": "GET",
"headers": []
}
},
"publisherName": "Microsoft Corporation",
"refundableQuantity": {
"totalQuantity": 1,
"details": [
{
"quantity": 1,
"allowedUntilDateTime": "2024-06-14T17:41:13.4675407Z"
}
]
},
"orderId": "79d9f5e2f43a",
"attributes": {
"objectType": "Subscription"
}
}
],
"attributes": { "objectType": "Collection" }
}