列出部署
列出应用最近的 Git 部署(GET /v2/apps//deployments),包含每次部署从 pending 到 success 的状态或错误代码。
GET
/
v2
/
apps
/
{app_id}
/
deployments
列出部署
curl --request GET \
--url https://api.squarecloud.app/v2/apps/{app_id}/deployments \
--header 'Authorization: <authorization>'import requests
url = "https://api.squarecloud.app/v2/apps/{app_id}/deployments"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.squarecloud.app/v2/apps/{app_id}/deployments', 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.squarecloud.app/v2/apps/{app_id}/deployments",
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: <authorization>"
],
]);
$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.squarecloud.app/v2/apps/{app_id}/deployments"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
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.squarecloud.app/v2/apps/{app_id}/deployments")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.squarecloud.app/v2/apps/{app_id}/deployments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"status": "success",
"response": [
[
{ "id": "96b1c6931c20b1555e612d3c8cd0a7b36f0fd5c7", "state": "pending", "date": "2026-05-28T21:47:33.608Z", "source": "git" },
{ "id": "96b1c6931c20b1555e612d3c8cd0a7b36f0fd5c7", "state": "clone", "date": "2026-05-28T21:47:34.019Z", "source": "git" },
{ "id": "96b1c6931c20b1555e612d3c8cd0a7b36f0fd5c7", "state": "commit", "date": "2026-05-28T21:47:36.240Z", "source": "git" },
{ "id": "96b1c6931c20b1555e612d3c8cd0a7b36f0fd5c7", "state": "restarting", "date": "2026-05-28T21:47:37.105Z", "source": "git" },
{ "id": "96b1c6931c20b1555e612d3c8cd0a7b36f0fd5c7", "state": "success", "date": "2026-05-28T21:47:41.872Z", "source": "git" }
]
]
}
需要具有
apps:read 权限范围的 API 密钥。
使用该端点可以查看最近部署期间发生的情况:每个内层数组记录一次部署尝试的生命周期,依次经过 pending、clone、commit、restarting 和 success 状态。失败的部署会以一个 error 事件结束,该事件带有一个 code(例如 AUTHENTICATION_REQUIRED、INVALID_BRANCH 或 CLONE_FAILED),有时还带有一个包含详细信息的 message。不存在 failed 状态。
只会记录 Git 部署,即来自 webhook 或 GitHub App 推送的部署,因此每个事件的 source 都是 git。zip 上传和提交应用调用不会出现在这里。
部署日志来自一个短期存活的集群缓存,因此只反映应用最近的活动,一旦没有记录的内容,就会返回空数组。若要查看当前配置的 Git 集成而非过去的部署尝试,请参阅获取当前部署。
参数
string
必填
应用的 ID。你可以在应用控制台的 URL 中找到它。
响应
string
指示调用是否成功。成功时为
success,否则为 error。array
{
"status": "success",
"response": [
[
{ "id": "96b1c6931c20b1555e612d3c8cd0a7b36f0fd5c7", "state": "pending", "date": "2026-05-28T21:47:33.608Z", "source": "git" },
{ "id": "96b1c6931c20b1555e612d3c8cd0a7b36f0fd5c7", "state": "clone", "date": "2026-05-28T21:47:34.019Z", "source": "git" },
{ "id": "96b1c6931c20b1555e612d3c8cd0a7b36f0fd5c7", "state": "commit", "date": "2026-05-28T21:47:36.240Z", "source": "git" },
{ "id": "96b1c6931c20b1555e612d3c8cd0a7b36f0fd5c7", "state": "restarting", "date": "2026-05-28T21:47:37.105Z", "source": "git" },
{ "id": "96b1c6931c20b1555e612d3c8cd0a7b36f0fd5c7", "state": "success", "date": "2026-05-28T21:47:41.872Z", "source": "git" }
]
]
}
相关内容
- CLI:
squarecloud app deploy list - SDK:
api.apps.deploys.list()(JavaScript)、client.apps.deploys.list()(Python)、c.Apps.Deploys.List()(Go)
⌘I
列出部署
curl --request GET \
--url https://api.squarecloud.app/v2/apps/{app_id}/deployments \
--header 'Authorization: <authorization>'import requests
url = "https://api.squarecloud.app/v2/apps/{app_id}/deployments"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.squarecloud.app/v2/apps/{app_id}/deployments', 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.squarecloud.app/v2/apps/{app_id}/deployments",
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: <authorization>"
],
]);
$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.squarecloud.app/v2/apps/{app_id}/deployments"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
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.squarecloud.app/v2/apps/{app_id}/deployments")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.squarecloud.app/v2/apps/{app_id}/deployments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"status": "success",
"response": [
[
{ "id": "96b1c6931c20b1555e612d3c8cd0a7b36f0fd5c7", "state": "pending", "date": "2026-05-28T21:47:33.608Z", "source": "git" },
{ "id": "96b1c6931c20b1555e612d3c8cd0a7b36f0fd5c7", "state": "clone", "date": "2026-05-28T21:47:34.019Z", "source": "git" },
{ "id": "96b1c6931c20b1555e612d3c8cd0a7b36f0fd5c7", "state": "commit", "date": "2026-05-28T21:47:36.240Z", "source": "git" },
{ "id": "96b1c6931c20b1555e612d3c8cd0a7b36f0fd5c7", "state": "restarting", "date": "2026-05-28T21:47:37.105Z", "source": "git" },
{ "id": "96b1c6931c20b1555e612d3c8cd0a7b36f0fd5c7", "state": "success", "date": "2026-05-28T21:47:41.872Z", "source": "git" }
]
]
}

