サブスクリプションの中断

適用対象: パートナー センター | 21Vianet が運営するパートナー センター | Microsoft Cloud for US Government のパートナー センター

不正行為または未払いのために顧客とサブスクリプション ID と一致する サブスクリプション リソースを 中断します。

パートナー センターでは、最初に 顧客を選択することで、この操作を実行できます。 次に、名前を変更する対象のサブスクリプションを選択します。 完了するには、[ 中断 ] ボタンを選択し、[送信] を選択 します。

前提条件

  • パートナー センターの認証に関するページで説明している資格情報。 このシナリオでは、スタンドアロンの App と App+User の両方の資格情報を使用した認証がサポートされています。

  • 顧客 ID です (customer-tenant-id)。 顧客の ID がわからない場合は、 パートナー センター で [顧客] ワークスペースを選択し、 次に顧客 の一覧から顧客を探し、[ アカウント] を選択します。 お客様のアカウント ページで、 [顧客のアカウント情報] セクションの Microsoft ID を探します。 Microsoft ID は、顧客 ID (customer-tenant-id) と同じです。

  • サブスクリプション ID。

C#

顧客のサブスクリプションを中断するには、まずサブスクリプション を取得してから、サブスクリプションの Status プロパティを変更します。 状態コードの詳細については、「SubscriptionStatus 列挙/dotnet/api/microsoft.store.partnercenter.models.subscriptions.subscriptionstatus」を参照してください。 変更が行われたら、 IAggregatePartner.Customers コレクションを使用し、 ById() メソッドを呼び出します。 次に、 Subscriptions プロパティを 呼び出し、その後に ById() メソッドを呼び出します。 次に、 Patch() メソッドを呼び出して終了します。

// IAggregatePartner partnerOperations;
// var selectedCustomerId as string;
// Subscription selectedSubscription;

updatedSubscription = partnerOperations.Customers.ById(selectedCustomerId).Subscriptions.ById(selectedSubscription.Id).Patch(
   new Subscription()
   {
      Status = SubscriptionStatus.Suspended
   });

サンプル: コンソール テスト アプリプロジェクト: PartnerSDK.FeatureSample クラス: UpdateSubscription.cs

REST 要求

要求の構文

認証方法 要求 URI
PATCH {baseURL}/v1/customers/{customer-tenant-id}/subscriptions/{id-for-subscription} HTTP/1.1

URI パラメーター

次の表に、サブスクリプションを中断するために必要なクエリ パラメーターの一覧を示します。

名前 Type 必須 説明
customer-tenant-id guid Y 顧客に対応する GUID。
id-for-subscription guid Y サブスクリプションに対応する GUID。

要求ヘッダー

詳細については、「パートナー センター REST ヘッダー」を参照してください。

[要求本文]

要求本文には完全な Subscription リソースが必要です。 Status プロパティが更新されていることを確認します。

要求の例

PATCH https://api.partnercenter.microsoft.com/v1/customers/<customer-tenant-id>/subscriptions/<id-for-subscription> HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: ca7c39f7-1a80-43bc-90d8-ee7d1cad3831
MS-CorrelationId: ec8f62e5-1d92-47e9-8d5d-1924af105f2c
If-Match: <etag>
Content-Type: application/json
Content-Length: 1029
Expect: 100-continue
Connection: Keep-Alive

{
    "Id": "83ef9d05-4169-4ef9-9657-0e86b1eab1de",
    "FriendlyName": "nickname",
    "Quantity": 2,
    "UnitType": "none",
    "ParentSubscriptionId": null,
    "CreationDate": "2015-11-25T06:41:12Z",
    "EffectiveStartDate": "2015-11-24T08:00:00Z",
    "CommitmentEndDate": "2016-12-12T08:00:00Z",
    "Status": "suspended",
    "AutoRenewEnabled": false,
    "BillingType": "none",
    "PartnerId": null,
    "ContractType": "subscription",
    "OrderId": "6183db3d-6318-4e52-877e-25806e4971be",
    "Attributes": {
        "Etag": "<etag>",
        "ObjectType": "Subscription"
    }
}

REST 応答

成功した場合、このメソッドは応答本文で更新された Subscription リソース プロパティを返します。

応答の成功とエラーのコード

各応答には、成功または失敗を示す HTTP ステータス コードと、追加のデバッグ情報が付属しています。 このコード、エラーの種類、追加のパラメーターを読み取るには、ネットワーク トレース ツールを使用します。 完全な一覧については、エラー コードに関するページを参照してください。

応答の例

PATCH https://api.partnercenter.microsoft.com/v1/customers/<customer-tenant-id>/subscriptions/<subscriptionID> HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-Contract-Version: v1
MS-RequestId: ca7c39f7-1a80-43bc-90d8-ee7d1cad3831
MS-CorrelationId: ec8f62e5-1d92-47e9-8d5d-1924af105f2c
Content-Type: application/json
Content-Length: 1029
Expect: 100-continue
Connection: Keep-Alive

{
    "Id": "83ef9d05-4169-4ef9-9657-0e86b1eab1de",
    "FriendlyName": "nickname",
    "Quantity": 2,
    "UnitType": "none",
    "ParentSubscriptionId": null,
    "CreationDate": "2015-11-25T06:41:12Z",
    "EffectiveStartDate": "2015-11-24T08:00:00Z",
    "CommitmentEndDate": "2016-12-12T08:00:00Z",
    "Status": "suspended",
    "AutoRenewEnabled": false,
    "BillingType": "none",
    "PartnerId": null,
    "ContractType": "subscription",
    "Links": {
        "Offer": {
            "Uri": "/v1/offers/0CCA44D6-68E9-4762-94EE-31ECE98783B9",
            "Method": "GET",
            "Headers": []
        },
        "Entitlement": {
            "Uri": "/entitlements?key=<key>",
            "Method": "GET",
            "Headers": []
        },
        "Self": {
            "Uri": "/subscriptions?key=<key>",
            "Method": "GET",
            "Headers": []
        }
    },
    "OrderId": "6183db3d-6318-4e52-877e-25806e4971be",
    "Attributes": {
        "Etag": "<etag>",
        "ObjectType": "Subscription"
    }
}