Ottenere un elenco delle offerte per un mercato
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 che contiene tutte le offerte per un mercato specifico.
Prerequisiti
- Credenziali descritte in Autenticazione del Centro per i partner. Questo scenario supporta l'autenticazione con le credenziali app autonome e App+Utente.
C#
Per ottenere un elenco di offerte in un determinato mercato, usare la raccolta IAggregatePartner.Offers, selezionare il mercato per paese/area geografica e chiamare il metodo Get() o Get Async().
// IAggregatePartner partnerOperations;
ResourceCollection<Offer> offers = partnerOperations.Offers.ByCountry("US").Get();
Esempio: App di test della console. Progetto: Classe PartnerSDK.FeatureSample: Offers.cs
Richiesta REST
Sintassi della richiesta
Metodo | URI della richiesta |
---|---|
GET | {baseURL}/v1/offers?country={country-id} HTTP/1.1 |
Parametro URI
Questa tabella elenca i parametri di query necessari per ottenere le offerte.
Nome | Tipo | Necessario | Descrizione |
---|---|---|---|
country-id | string | S | ID del paese o dell'area. |
Intestazioni delle richieste
- È necessario un ID impostazioni locali formattato come stringa. Per altre informazioni, vedi Intestazioni REST del Centro per i partner.
Testo della richiesta
Nessuno.
Esempio di richiesta
GET https://api.partnercenter.microsoft.com/v1/offers?country=<country-id> HTTP/1.1
Authorization: Bearer
Accept: application/json
MS-RequestId: 031160b2-b0b0-4d40-b2b1-aaa9bb84211d
MS-CorrelationId: 7c1f6619-c176-4040-a88f-2c71f3ba4533
X-Locale: <locale-id>
Risposta REST
In caso di esito positivo, questo metodo restituisce una raccolta di risorse Offer nel corpo della risposta.
Codici di errore e di esito della risposta
Ogni risposta viene fornita con un codice di stato HTTP che ne indica l'esito e con informazioni di debug aggiuntive. Usa uno strumento di traccia di rete per leggere il codice, il tipo di errore e parametri aggiuntivi. Per l'elenco completo, vedi Codici di errore.
Esempio di risposta
HTTP/1.1 200 OK
Content-Length: 26584
Content-Type: application/json
MS-CorrelationId: 7c1f6619-c176-4040-a88f-2c71f3ba4533
MS-RequestId: 031160b2-b0b0-4d40-b2b1-aaa9bb84211d
Date: Mon, 23 Nov 2015 23:20:44 GMT
{
"totalCount":12,"items":[{
"id":"E60E0348-1710-484B-992A-32B294D4CDE1",
"name":"Azure Rights Management Premium (Government Pricing)",
"description":"Microsoft Azure Rights Management Premium helps you protect confidential documents and email with strong encryption.
Control the use of your information by specifying who can view, edit, print, save and share your data.
Simple to use and integrated with Microsoft Office, SharePoint and Exchange.",
"minimumQuantity":1,
"maximumQuantity":10000000,
"rank":5,
"uri":"/3c95518e-8c37-41e3-9627-0ca339200f53/Offers/E60E0348-1710-484B-992A-32B294D4CDE1",
"locale":"EN-US",
"country":"US",
"category":{
"id":"Government_Key",
"name":"Government",
"rank":40,
"locale":"en-us",
"country":"US",
"attributes":{
"objectType":"OfferCategory"
}
},
"prerequisiteOffers":[],
"isAddOn":false,
"isAvailableForPurchase":true,
"billing":"license",
"isAutoRenewable":true,
"product":{
"id":"c52ea49f-fe5d-4e95-93ba-1de91d380f89",
"name":"Azure Rights Management Premium",
"unit":"Licenses"
},
"unitType":"Licenses",
"links":{
"learnMore":{
"uri":"http://g.microsoftonline.com/0BXPS00en/0000",
"method":"GET",
"headers":[]
},
"self":{
"uri":"/offers/E60E0348-1710-484B-992A-32B294D4CDE1",
"method":"GET",
"headers":[]
}
},
"attributes":{
"objectType":"Offer"
}
},
"links":{
"self":{
"uri":"/v1/offers?country={country-id}",
"method":"GET",
"headers":[]
},
"previous":{
"uri":"/v1/offers?country={country-id}",
"method":"GET",
"headers":[]
}
},
"attributes":{
"objectType":"Collection"
}
}