发布 Release
curl --request POST \
--url https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/releases \
--header 'Content-Type: application/json' \
--data '
{
"build_id": "<string>",
"version": "<string>",
"expected_revision": 123
}
'import requests
url = "https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/releases"
payload = {
"build_id": "<string>",
"version": "<string>",
"expected_revision": 123
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({build_id: '<string>', version: '<string>', expected_revision: 123})
};
fetch('https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/releases', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({build_id: '<string>', version: '<string>', expected_revision: 123})
};
fetch('https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/releases', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/releases"
payload := strings.NewReader("{\n \"build_id\": \"<string>\",\n \"version\": \"<string>\",\n \"expected_revision\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/releases")
.header("Content-Type", "application/json")
.body("{\n \"build_id\": \"<string>\",\n \"version\": \"<string>\",\n \"expected_revision\": 123\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/releases",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'build_id' => '<string>',
'version' => '<string>',
'expected_revision' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/releases")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"build_id\": \"<string>\",\n \"version\": \"<string>\",\n \"expected_revision\": 123\n}"
response = http.request(request)
puts response.read_bodyusing RestSharp;
var options = new RestClientOptions("https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/releases");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n \"build_id\": \"<string>\",\n \"version\": \"<string>\",\n \"expected_revision\": 123\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"build_id\": \"<string>\",\n \"version\": \"<string>\",\n \"expected_revision\": 123\n}")
val request = Request.Builder()
.url("https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/releases")
.post(body)
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute()false{
"app_name": "<string>",
"namespace": "<string>",
"version": "<string>",
"build_id": "<string>",
"published_at": "<string>",
"missing_secrets": [
"<string>"
]
}发布与运营
发布 Release
把一个就绪的 Build 晋升为正式版本,版本号在此刻确定。
POST
/
v1
/
data-apps
/
{app_id}
/
releases
发布 Release
curl --request POST \
--url https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/releases \
--header 'Content-Type: application/json' \
--data '
{
"build_id": "<string>",
"version": "<string>",
"expected_revision": 123
}
'import requests
url = "https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/releases"
payload = {
"build_id": "<string>",
"version": "<string>",
"expected_revision": 123
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({build_id: '<string>', version: '<string>', expected_revision: 123})
};
fetch('https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/releases', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({build_id: '<string>', version: '<string>', expected_revision: 123})
};
fetch('https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/releases', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/releases"
payload := strings.NewReader("{\n \"build_id\": \"<string>\",\n \"version\": \"<string>\",\n \"expected_revision\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/releases")
.header("Content-Type", "application/json")
.body("{\n \"build_id\": \"<string>\",\n \"version\": \"<string>\",\n \"expected_revision\": 123\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/releases",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'build_id' => '<string>',
'version' => '<string>',
'expected_revision' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/releases")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"build_id\": \"<string>\",\n \"version\": \"<string>\",\n \"expected_revision\": 123\n}"
response = http.request(request)
puts response.read_bodyusing RestSharp;
var options = new RestClientOptions("https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/releases");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n \"build_id\": \"<string>\",\n \"version\": \"<string>\",\n \"expected_revision\": 123\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"build_id\": \"<string>\",\n \"version\": \"<string>\",\n \"expected_revision\": 123\n}")
val request = Request.Builder()
.url("https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/releases")
.post(body)
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute()false{
"app_name": "<string>",
"namespace": "<string>",
"version": "<string>",
"build_id": "<string>",
"published_at": "<string>",
"missing_secrets": [
"<string>"
]
}端点
POST https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/releases
404。
把指定的就绪 Build 晋升为正式版本。版本号在此刻确定:默认在当前最大版本上补丁号加一(首个为 0.1.0);显式给出的版本必须是三段数字且严格大于当前最大版本,用它来表达主版本或次版本升级。
前置条件:Build 存在且就绪;快照会重新过一遍校验流水线(Build 存续期间规范可能已演进);给了 expected_revision 时工作区不得被并发修改。并发发布由(发布者,应用名,版本)唯一约束仲裁,自动版本号冲突时引擎重算并重试一次。发布后工作区保留,它可能已经领先于发布的快照。
请求
路径参数
string
必填
App 引用。
请求体
string
必填
要发布的 Build 标识,必须处于就绪状态。
string
显式版本号,三段数字;省略则补丁号加一。
integer
期望的当前草稿版本号,不一致则
409。示例请求
curl -X POST \
-H "Authorization: Bearer $BAZHUAYU_API_KEY" \
-H "Content-Type: application/json" \
-d '{"build_id": "bld_a583f440a0ab", "version": "1.2.0"}' \
"https://api-datahub.bazhuayu.com/v1/data-apps/carol/reviews-query/releases"
响应
200 成功
{
"data": {
"version": "1.2.0",
"build_id": "bld_a583f440a0ab",
"published_at": "2026-09-15T08:00:00+00:00",
"latest": true
}
}
data 字段中,其内容如下。
string
必填
—
string
—
string
必填
发布的版本号。
string
必填
对应的 Build。
string
发布时间。
string[]
—
错误
| HTTP | code | category | 说明 |
|---|---|---|---|
| 401 | unauthorized | forbidden | 缺少或无效的 API Key。 |
| 404 | build-not-found | not_found | Build 快照不存在。 |
| 409 | build-not-ready | invalid_input | Build 尚未就绪(构建中或失败),不能发布。 |
| 422 | invalid-manifest | invalid_input | manifest 未通过校验,issues[] 列出问题。 |
| 409 | revision-conflict | invalid_input | expected_revision 与当前草稿版本号不一致,说明有并发修改。 |
{"error": {code, category, message, retryable}},见错误。
