Method: subscriptions.delete
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
HTTP 要求
DELETE https://reseller.googleapis.com/apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}
這個網址使用 gRPC 轉碼語法。
路徑參數
參數 |
customerId |
string
這可以是客戶的主網域名稱,或客戶的專屬 ID。如果客戶的網域名稱有所變更,您就無法使用舊網域名稱存取客戶,但您隨時可以使用客戶的專屬 ID (由 API 傳回)。建議您在適用的情況下,將專屬 ID 儲存在系統中。
|
subscriptionId |
string
這是必要屬性。subscriptionId 是訂閱 ID,每位客戶皆有專屬 ID。由於訂閱項目更新時,subscriptionId 會有所變更,因此建議您不要將此 ID 用於永久性資料的索引鍵。您可以使用擷取所有經銷商訂閱項目方法找到 subscriptionId 。
|
查詢參數
參數 |
deletionType |
enum (DeletionType )
deletionType 查詢字串可用於取消、降級或暫停訂閱。
|
回應主體
用於表示任何 HTTP 主體的訊息;只能用於無法以 JSON 表示的酬載格式,例如未經處理的二進位檔或 HTML 網頁。
這個訊息可以用於要求及回應中的串流和非串流 API 方法。
這個訊息可以當做頂層要求欄位;想從網址或 HTTP 範本中將參數擷取至要求欄位,同時又想存取未經處理的 HTTP 主體時,這個做法就非常便利。
範例:
message GetResourceRequest {
// A unique request id.
string requestId = 1;
// The raw HTTP body is bound to this field.
google.api.HttpBody http_body = 2;
}
service ResourceService {
rpc GetResource(GetResourceRequest)
returns (google.api.HttpBody);
rpc UpdateResource(google.api.HttpBody)
returns (google.protobuf.Empty);
}
串流方法範例:
service CaldavService {
rpc GetCalendar(stream google.api.HttpBody)
returns (stream google.api.HttpBody);
rpc UpdateCalendar(stream google.api.HttpBody)
returns (stream google.api.HttpBody);
}
使用這個類型只會改變要求和回應主體的處理方式,所有其他功能的運作方式皆維持不變。
如果成功,回應會是一般 HTTP 回應,其格式由方法定義。
JSON 表示法 |
{
"contentType": string,
"data": string,
"extensions": [
{
"@type": string,
field1: ...,
...
}
]
} |
欄位 |
contentType |
string
指定主體內容類型的 HTTP Content-Type 標頭值。
|
data |
string (bytes format)
以原始二進位檔格式顯示 HTTP 要求/回應主體。 Base64 編碼字串。
|
extensions[] |
object
應用程式專屬回應中繼資料。必須在串流 API 的第一個回應中進行設定。 含有任意類型欄位的物件。額外的 "@type" 欄位則包含能辨識類型的 URI。範例:{ "id": 1234, "@type": "types.example.com/standard/id" } 。
|
授權範圍
需要下列 OAuth 範圍:
https://www.googleapis.com/auth/apps.order
詳情請參閱授權指南。
DeletionType
列舉 |
deletion_type_undefined |
|
cancel |
立即取消訂閱。但不適用於 G Suite 訂閱方案。 |
transfer_to_direct |
將訂閱直接轉移至 Google。 客戶會立即轉移至與 Google 的直接帳單關係,並在短時間內不會中斷服務。之後,客戶可以選擇使用信用卡直接向 Google 設定結帳資訊,也可以轉移至其他經銷商。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[],[],null,["# Method: subscriptions.delete\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n - [JSON representation](#body.HttpBody.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [DeletionType](#DeletionType)\n- [Try it!](#try-it)\n\nCancels, suspends, or transfers a subscription to direct.\n\n### HTTP request\n\n`DELETE https://reseller.googleapis.com/apps/reseller/v1/customers/{customerId}/subscriptions/{subscriptionId}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `customerId` | `string` This can be either the customer's primary domain name or the customer's unique identifier. If the domain name for a customer changes, the old domain name cannot be used to access the customer, but the customer's unique identifier (as returned by the API) can always be used. We recommend storing the unique identifier in your systems where applicable. |\n| `subscriptionId` | `string` This is a required property. The `subscriptionId` is the subscription identifier and is unique for each customer. Since a `subscriptionId` changes when a subscription is updated, we recommend to not use this ID as a key for persistent data. And the `subscriptionId` can be found using the [retrieve all reseller subscriptions](https://developers.google.com/workspace/admin/reseller/v1/how-tos/manage_subscriptions#get_all_subscriptions) method. |\n\n### Query parameters\n\n| Parameters ||\n|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `deletionType` | `enum (`[DeletionType](/workspace/admin/reseller/reference/rest/v1/subscriptions/delete#DeletionType)`)` The `deletionType` query string enables the cancellation, downgrade, or suspension of a subscription. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nMessage that represents an arbitrary HTTP body. It should only be used for payload formats that can't be represented as JSON, such as raw binary or an HTML page.\n\nThis message can be used both in streaming and non-streaming API methods in the request as well as the response.\n\nIt can be used as a top-level request field, which is convenient if one wants to extract parameters from either the URL or HTTP template into the request fields and also want access to the raw HTTP body.\n\nExample: \n\n message GetResourceRequest {\n // A unique request id.\n string requestId = 1;\n\n // The raw HTTP body is bound to this field.\n google.api.HttpBody http_body = 2;\n\n }\n\n service ResourceService {\n rpc GetResource(GetResourceRequest)\n returns (google.api.HttpBody);\n rpc UpdateResource(google.api.HttpBody)\n returns (google.protobuf.Empty);\n\n }\n\nExample with streaming methods: \n\n service CaldavService {\n rpc GetCalendar(stream google.api.HttpBody)\n returns (stream google.api.HttpBody);\n rpc UpdateCalendar(stream google.api.HttpBody)\n returns (stream google.api.HttpBody);\n\n }\n\nUse of this type only changes how the request and response bodies are handled, all other features will continue to work unchanged.\n\nIf successful, the response is a generic HTTP response whose format is defined by the method.\n\n| JSON representation |\n|------------------------------------------------------------------------------------------------------------|\n| ``` { \"contentType\": string, \"data\": string, \"extensions\": [ { \"@type\": string, field1: ..., ... } ] } ``` |\n\n| Fields ||\n|----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `contentType` | `string` The HTTP Content-Type header value specifying the content type of the body. |\n| `data` | `string (`[bytes](https://developers.google.com/discovery/v1/type-format)` format)` The HTTP request/response body as raw binary. A base64-encoded string. |\n| `extensions[]` | `object` Application specific response metadata. Must be set in the first response for streaming APIs. An object containing fields of an arbitrary type. An additional field `\"@type\"` contains a URI identifying the type. Example: `{ \"id\": 1234, \"@type\": \"types.example.com/standard/id\" }`. |\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/apps.order`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent).\n\nDeletionType\n------------\n\n| Enums ||\n|---------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `deletion_type_undefined` | |\n| `cancel` | Cancels the subscription immediately. This does not apply to a G Suite subscription. |\n| `transfer_to_direct` | Transfers a subscription directly to Google. The customer is immediately transferred to a direct billing relationship with Google and is given a short amount of time with no service interruption. The customer can then choose to set up billing directly with Google by using a credit card, or they can transfer to another reseller. |"]]