The Get All Subscriptions operation returns all the subscriptions for that particular user in the system as a list of subscription objects

Request

The Get All Subscriptions request may be specified as follows.

Method Request URI HTTP Version

GET

https://tenant-management.contoso.net/subscriptions

HTTP/1.1

URI Parameters

None.

Request Headers

The following table describes request headers.

Request Header Description

Authorization

Specifies the credentials for this request. The value of this header must be set Negotiate <token>.

x-ms-principal-id

The user credentials for the principal (the user). For example, this could be CONTOSO\username.

Request Body

None.

Response

The response includes an HTTP status code, a set of response headers, and a response body.

Status Code

The status code is embedded in the response for this operation; if successful, it will be status code 200 (OK).

Response Headers

The response for this operation includes the following headers. The response may also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.

Response Header Description

Content-Length

This lists the number of resource providers in the system

Response Body

The format of the response body is as follows:

  Copy Code
http://localhost:777/subscriptions
{
	"items": [
		{
			"SubscriptionID": "e7389d7d-c4b6-4fce-9923-607e61f29306",
			"SubscriptionName": "s0",
			"SubscriptionStatus": "Active",
			"AccountAdminLiveEmailId": "test1@test.com",
			"ServiceAdminLiveEmailId": null,
			"Features": null,
			"OfferFriendlyName": "offer1",
			"OfferCategory": "offer1",
			"RegisteredServices": null,
			"Created": "2012-11-21T22:26:52.92",
			"FanoutState": 0,
			"FanoutErrors": []
	}
	],
	"filteredTotalCount": 1,
	"totalCount": 1
}

The following table describes the key elements of the response body:

Element Name

Description

AccountAdminLiveEmailId

The Microsoft email ID associated with the user account on this subscription.

SubscriptionName

The name can be used identify the subscription for your tracking purposes.

OfferCategory

Specifies the offer ID associated with the subscription

OfferFriendlyName

Specifies the offer friendly name associated with the subscription

SubscriptionId

Specifies the subscription ID

SubcriptionStatus

Specifies whether the subscription is active

RegisteredServices

Specifies any services registered with the subscription

Example

Get all subscriptions.

  Copy Code
public QueryResult<AdminSubscription> GetAllSubscriptions(string tenantServiceEndpoint)
{
	HttpClient httpClient = new HttpClient();
	httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("BASIC", Convert.ToBase64String(UnicodeEncoding.Unicode.GetBytes("TenantPortal:" + ”password”)))));

	string subscriptionEndpoint = tenantServiceEndpoint + "subscriptions/";
	var response = httpClient.GetAsync(subscriptionEndpoint);
	var resultsStr = response.Result.Content.ReadAsStringAsync().Result;
	var result = JsonConvert.DeserializeObject<QueryResult<AdminSubscription>>(resultsStr);
	return result;
}