列出折扣
curl --request GET \
--url https://{api}.subotiz.com/api/v1/discount \
--header 'Authorization: Bearer <token>' \
--header 'Request-Id: <request-id>'const options = {
method: 'GET',
headers: {'Request-Id': '<request-id>', Authorization: 'Bearer <token>'}
};
fetch('https://{api}.subotiz.com/api/v1/discount', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{api}.subotiz.com/api/v1/discount"
headers = {
"Request-Id": "<request-id>",
"Authorization": "Bearer <token>"
}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{api}.subotiz.com/api/v1/discount",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Request-Id: <request-id>"
],
]);
$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}.subotiz.com/api/v1/discount"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Request-Id", "<request-id>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{api}.subotiz.com/api/v1/discount")
.header("Request-Id", "<request-id>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{api}.subotiz.com/api/v1/discount")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Request-Id"] = '<request-id>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"code": "<string>",
"message": "<string>",
"data": {
"has_more": true,
"list": [
{
"id": "<string>",
"discount_name": "<string>",
"status": "<string>",
"discount_code": "<string>",
"discount_method": "<string>",
"starts_at": "<string>",
"ends_at": "<string>",
"created_at": "<string>",
"updated_at": "<string>"
}
]
}
}折扣
列出折扣
列出折扣
GET
/
api
/
v1
/
discount
列出折扣
curl --request GET \
--url https://{api}.subotiz.com/api/v1/discount \
--header 'Authorization: Bearer <token>' \
--header 'Request-Id: <request-id>'const options = {
method: 'GET',
headers: {'Request-Id': '<request-id>', Authorization: 'Bearer <token>'}
};
fetch('https://{api}.subotiz.com/api/v1/discount', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{api}.subotiz.com/api/v1/discount"
headers = {
"Request-Id": "<request-id>",
"Authorization": "Bearer <token>"
}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{api}.subotiz.com/api/v1/discount",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Request-Id: <request-id>"
],
]);
$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}.subotiz.com/api/v1/discount"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Request-Id", "<request-id>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{api}.subotiz.com/api/v1/discount")
.header("Request-Id", "<request-id>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{api}.subotiz.com/api/v1/discount")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Request-Id"] = '<request-id>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"code": "<string>",
"message": "<string>",
"data": {
"has_more": true,
"list": [
{
"id": "<string>",
"discount_name": "<string>",
"status": "<string>",
"discount_code": "<string>",
"discount_method": "<string>",
"starts_at": "<string>",
"ends_at": "<string>",
"created_at": "<string>",
"updated_at": "<string>"
}
]
}
}授权
Bearer API Key 鉴权。格式:Authorization: Bearer {your_api_key}
请求头
请求的唯一标识符
查询参数
按折扣 ID 筛选。数组大小限制:[0,100]
折扣状态:
- draft:折扣已创建但尚未激活或对用户可见
- ongoing:折扣当前处于活动状态并可供使用
- not_started:折扣已定义,但其开始时间尚未到达
- completed:折扣已结束,不再可供使用
按折扣代码筛选。数组大小限制:[0,100]
用于分页的游标。starting_after 是定义您在列表中位置的对象 ID。例如,如果想获取下一页,可以在第一次获取对象列表之后,使用最后一个对象的 id 作为参数值。不能和 ending_before 同时使用
用于分页的游标。ending_before 是定义您在列表中位置的对象 ID。例如,如果想获取上一页,可以在第一次获取对象列表之后,使用第一个对象的 id 作为参数值。不能和 starting_after 同时使用
分页参数,每页数量,默认:10,接口默认按创建时间倒序排序。限制:[1, 100]
用于过滤的最小值(不包含,RFC3339格式的UTC时间,例如'2025-01-01T00:00:00Z')
用于过滤的最小值(包含,RFC3339格式的UTC时间,例如'2025-01-01T00:00:00Z')
用于过滤的最大值(不包含,RFC3339格式的UTC时间,例如'2025-01-01T00:00:00Z')
用于过滤的最大值(包含,RFC3339格式的UTC时间,例如'2025-01-01T00:00:00Z')
此页面对您有帮助吗?