Get a list of self-serve policies
Gets a collection of resources that represents self-serve policies for an entity.
Prerequisites
- Credentials as described in Partner Center authentication. This scenario supports authentication with Application+User credentials.
C#
To get a list of all self-serve policies:
- Call the IAggregatePartner.With(IRequestContext) method with the entity identifier to retrieve an interface to operations on the policies.
// IAggregatePartner partnerOperations;
// All the operations executed on this partner operation instance will share the same correlation Id but will differ in request Id
IPartner scopedPartnerOperations = partnerOperations.With(RequestContextFactory.Instance.Create(Guid.NewGuid()));
// gets the self-serve policies
var SelfServePolicies = scopedPartnerOperations.SelfServePolicies.Get(customerIdAsEntity);
For an example, see the following:
- Sample: Console test app
- Project: PartnerSDK.FeatureSamples
- Class: GetSelfServePolicies.cs
REST request
Request syntax
Method | Request URI |
---|---|
GET | {baseURL}/v1/SelfServePolicy?entity_id={entity_id} HTTP/1.1 |
URI parameter
Use the following query parameter to get a list of customers.
Name | Type | Required | Description |
---|---|---|---|
entity_id | string | Y | The entity identifier requesting access for. This will be the customer's tenant ID. |
Request headers
For more information, see Headers.
Request body
None.
Request example
GET https://api.partnercenter.microsoft.com/v1/SelfServePolicy?entity_id=0431a72c-7d8a-4393-b25e-ef63f5efb415 HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 3705fc6d-4127-4a87-bdba-9658f73fe019
MS-CorrelationId: b12260fb-82de-4701-a25f-dcd367690645
REST response
If successful, this method returns a collection of SelfServePolicy resources in the response body.
Response success and error codes
Each response comes with an HTTP status code that indicates success or failure and additional debugging information. Use a network trace tool to read this code, error type, and additional parameters. For a full list, see Error Codes.
Response example
HTTP/1.1 200 OK
Content-Length: 15650
Content-Type: application/json
MS-CorrelationId: b12260fb-82de-4701-a25f-dcd367690645
MS-RequestId: 3705fc6d-4127-4a87-bdba-9658f73fe019
Date: Fri, 20 Nov 2015 01:08:23 GMT
{
"totalCount": 1,
"items": [{
"id": "634f6379-ad54-449b-9821-564f737158ab_0431a72c-7d8a-4393-b25e-ef63f5efb415",
"selfServeEntity": {
"selfServeEntityType": "customer",
"tenantID": "0431a72c-7d8a-4393-b25e-ef63f5efb415"
},
"grantor": {
"grantorType": "billToPartner",
"tenantID": "634f6379-ad54-449b-9821-564f737158ab"
},
"permissions": [
{
"resource": "AzureReservedInstances",
"action": "Purchase"
},
{
"resource": "AzureSavingsPlan",
"action": "Purchase"
}
],
"attributes": {
"etag": "\"933523d1-3f63-4fc3-8789-5e21c02cdaed\"",
"objectType": "SelfServePolicy"
}
}],
"attributes": {
"objectType": "Collection"
}
}
משוב
https://aka.ms/ContentUserFeedback.
בקרוב: במהלך 2024, נפתור בעיות GitHub כמנגנון המשוב לתוכן ונחליף אותו במערכת משוב חדשה. לקבלת מידע נוסף, ראה:שלח והצג משוב עבור