订阅计划
从计划中移除促销
从订阅计划中移除促销。已经拥有该促销的订阅会保留其副本
DELETE
/
subscriptions
/
plans
/
{plan_id}
/
promotions
/
{promotion_id}
从计划中移除促销
curl --request DELETE \
--url https://api-sandbox.y.uno/v1/subscriptions/plans/{plan_id}/promotions/{promotion_id} \
--header 'X-Account-Code: <x-account-code>' \
--header 'private-secret-key: <api-key>' \
--header 'public-api-key: <api-key>'import requests
url = "https://api-sandbox.y.uno/v1/subscriptions/plans/{plan_id}/promotions/{promotion_id}"
headers = {
"X-Account-Code": "<x-account-code>",
"public-api-key": "<api-key>",
"private-secret-key": "<api-key>"
}
response = requests.delete(url, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {
'X-Account-Code': '<x-account-code>',
'public-api-key': '<api-key>',
'private-secret-key': '<api-key>'
}
};
fetch('https://api-sandbox.y.uno/v1/subscriptions/plans/{plan_id}/promotions/{promotion_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-sandbox.y.uno/v1/subscriptions/plans/{plan_id}/promotions/{promotion_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"X-Account-Code: <x-account-code>",
"private-secret-key: <api-key>",
"public-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.y.uno/v1/subscriptions/plans/{plan_id}/promotions/{promotion_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("X-Account-Code", "<x-account-code>")
req.Header.Add("public-api-key", "<api-key>")
req.Header.Add("private-secret-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api-sandbox.y.uno/v1/subscriptions/plans/{plan_id}/promotions/{promotion_id}")
.header("X-Account-Code", "<x-account-code>")
.header("public-api-key", "<api-key>")
.header("private-secret-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/subscriptions/plans/{plan_id}/promotions/{promotion_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-Account-Code"] = '<x-account-code>'
request["public-api-key"] = '<api-key>'
request["private-secret-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": "PROMOTION_NOT_FOUND",
"messages": [
"Promotion not found."
]
}从计划中移除促销的附加关系。该计划不再提供此促销,因此无法将其应用于该计划上的新订阅。已经拥有该促销的订阅不会改变:它们会保留其副本,直到其变为
COMPLETED 或 ENDED。
响应没有响应体。要在单个订阅上结束促销,请使用从订阅中移除促销。
更改
cycles附加关系不可编辑。要更改 cycles 或 on_pause,请使用此 endpoint 移除该附加关系,然后重新附加促销。错误
| HTTP | code | 发生情况 |
|---|---|---|
404 | PLAN_NOT_FOUND | 该计划不存在。 |
404 | PROMOTION_NOT_FOUND | 该促销未附加到此计划。 |
授权
请求头
您的 Yuno Dashboard 中的 account_id(UUID)。必填:缺少该参数时返回 400 BAD_REQUEST("Invalid x-account-code header.")。
响应
204。促销已从计划中移除。响应没有响应体。
此页面对您有帮助吗?
⌘I
从计划中移除促销
curl --request DELETE \
--url https://api-sandbox.y.uno/v1/subscriptions/plans/{plan_id}/promotions/{promotion_id} \
--header 'X-Account-Code: <x-account-code>' \
--header 'private-secret-key: <api-key>' \
--header 'public-api-key: <api-key>'import requests
url = "https://api-sandbox.y.uno/v1/subscriptions/plans/{plan_id}/promotions/{promotion_id}"
headers = {
"X-Account-Code": "<x-account-code>",
"public-api-key": "<api-key>",
"private-secret-key": "<api-key>"
}
response = requests.delete(url, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {
'X-Account-Code': '<x-account-code>',
'public-api-key': '<api-key>',
'private-secret-key': '<api-key>'
}
};
fetch('https://api-sandbox.y.uno/v1/subscriptions/plans/{plan_id}/promotions/{promotion_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-sandbox.y.uno/v1/subscriptions/plans/{plan_id}/promotions/{promotion_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"X-Account-Code: <x-account-code>",
"private-secret-key: <api-key>",
"public-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.y.uno/v1/subscriptions/plans/{plan_id}/promotions/{promotion_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("X-Account-Code", "<x-account-code>")
req.Header.Add("public-api-key", "<api-key>")
req.Header.Add("private-secret-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api-sandbox.y.uno/v1/subscriptions/plans/{plan_id}/promotions/{promotion_id}")
.header("X-Account-Code", "<x-account-code>")
.header("public-api-key", "<api-key>")
.header("private-secret-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/subscriptions/plans/{plan_id}/promotions/{promotion_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-Account-Code"] = '<x-account-code>'
request["public-api-key"] = '<api-key>'
request["private-secret-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": "PROMOTION_NOT_FOUND",
"messages": [
"Promotion not found."
]
}