调整可见性与维护状态
curl --request PATCH \
--url https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/settings \
--header 'Content-Type: application/json' \
--data '
{
"scope": {},
"accepting_runs": true,
"pause_message": "<string>",
"source_locale": "<string>"
}
'import requests
url = "https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/settings"
payload = {
"scope": {},
"accepting_runs": True,
"pause_message": "<string>",
"source_locale": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
scope: {},
accepting_runs: true,
pause_message: '<string>',
source_locale: '<string>'
})
};
fetch('https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/settings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
scope: {},
accepting_runs: true,
pause_message: '<string>',
source_locale: '<string>'
})
};
fetch('https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/settings', 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}/settings"
payload := strings.NewReader("{\n \"scope\": {},\n \"accepting_runs\": true,\n \"pause_message\": \"<string>\",\n \"source_locale\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/settings")
.header("Content-Type", "application/json")
.body("{\n \"scope\": {},\n \"accepting_runs\": true,\n \"pause_message\": \"<string>\",\n \"source_locale\": \"<string>\"\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/settings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'scope' => [
],
'accepting_runs' => true,
'pause_message' => '<string>',
'source_locale' => '<string>'
]),
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}/settings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"scope\": {},\n \"accepting_runs\": true,\n \"pause_message\": \"<string>\",\n \"source_locale\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyusing RestSharp;
var options = new RestClientOptions("https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/settings");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n \"scope\": {},\n \"accepting_runs\": true,\n \"pause_message\": \"<string>\",\n \"source_locale\": \"<string>\"\n}", false);
var response = await client.PatchAsync(request);
Console.WriteLine("{0}", response.Content);
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"scope\": {},\n \"accepting_runs\": true,\n \"pause_message\": \"<string>\",\n \"source_locale\": \"<string>\"\n}")
val request = Request.Builder()
.url("https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/settings")
.patch(body)
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute()false{
"scope": "<string>",
"accepting_runs": true,
"pause_message": "<string>",
"source_locale": "<string>",
"warnings": [
{
"code": "<string>",
"params": {}
}
]
}发布与运营
调整可见性与维护状态
切换 App 的可见范围、维护开关与源语言,随时可逆。
PATCH
/
v1
/
data-apps
/
{app_id}
/
settings
调整可见性与维护状态
curl --request PATCH \
--url https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/settings \
--header 'Content-Type: application/json' \
--data '
{
"scope": {},
"accepting_runs": true,
"pause_message": "<string>",
"source_locale": "<string>"
}
'import requests
url = "https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/settings"
payload = {
"scope": {},
"accepting_runs": True,
"pause_message": "<string>",
"source_locale": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
scope: {},
accepting_runs: true,
pause_message: '<string>',
source_locale: '<string>'
})
};
fetch('https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/settings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
scope: {},
accepting_runs: true,
pause_message: '<string>',
source_locale: '<string>'
})
};
fetch('https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/settings', 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}/settings"
payload := strings.NewReader("{\n \"scope\": {},\n \"accepting_runs\": true,\n \"pause_message\": \"<string>\",\n \"source_locale\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/settings")
.header("Content-Type", "application/json")
.body("{\n \"scope\": {},\n \"accepting_runs\": true,\n \"pause_message\": \"<string>\",\n \"source_locale\": \"<string>\"\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/settings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'scope' => [
],
'accepting_runs' => true,
'pause_message' => '<string>',
'source_locale' => '<string>'
]),
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}/settings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"scope\": {},\n \"accepting_runs\": true,\n \"pause_message\": \"<string>\",\n \"source_locale\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyusing RestSharp;
var options = new RestClientOptions("https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/settings");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n \"scope\": {},\n \"accepting_runs\": true,\n \"pause_message\": \"<string>\",\n \"source_locale\": \"<string>\"\n}", false);
var response = await client.PatchAsync(request);
Console.WriteLine("{0}", response.Content);
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"scope\": {},\n \"accepting_runs\": true,\n \"pause_message\": \"<string>\",\n \"source_locale\": \"<string>\"\n}")
val request = Request.Builder()
.url("https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/settings")
.patch(body)
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute()false{
"scope": "<string>",
"accepting_runs": true,
"pause_message": "<string>",
"source_locale": "<string>",
"warnings": [
{
"code": "<string>",
"params": {}
}
]
}端点
PATCH https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/settings
404。
App 级、可逆、与生命周期正交的运营状态,随时可调:
scope:public市场可见 /private仅作者 /shared按授权名单(名单用分享端点维护)。accepting_runs:维护开关。false表示维护中,他人的新运行被拒(403 app-not-accepting-runs,message带pause_message);已有运行、已购数据和市场可见性不受影响;作者自测不受限。上游修好后切回true即可,不需要动生命周期。source_locale:manifest 所用的语言(如zh-CN/en-US),未设置为部署缺省。其他语言的译文叠加在这份原文之上。若新源语言已有译文,响应带translation-shadowed-by-source告警,不会自动删除。
请求
路径参数
string
必填
App 引用。
请求体
enum
可见范围。
public / private / shared。取值:public / private / shared。boolean
是否接受他人的新运行。
string
维护中给调用方看的留言。
string
manifest 的源语言代码。
示例请求
curl -X PATCH \
-H "Authorization: Bearer $BAZHUAYU_API_KEY" \
-H "Content-Type: application/json" \
-d '{"accepting_runs": false, "pause_message": "上游接口维护中,预计 18:00 恢复"}' \
"https://api-datahub.bazhuayu.com/v1/data-apps/carol/reviews-query/settings"
响应
200 成功
{
"data": {
"scope": "private",
"accepting_runs": true,
"pause_message": null,
"source_locale": "zh-CN",
"warnings": []
}
}
data 字段中,其内容如下。
string
必填
当前可见范围。
boolean
必填
当前维护开关。
string
当前维护留言。
string
必填
当前源语言。
错误
| HTTP | code | category | 说明 |
|---|---|---|---|
| 401 | unauthorized | forbidden | 缺少或无效的 API Key。 |
{"error": {code, category, message, retryable}},见错误。
