嵌入式組件
驗證小組件安裝
對小組件的配置以及(可選的)實際頁面運行預檢檢查。
POST
/
api
/
v1
/
iframes
/
{id}
/
verify
驗證小組件安裝
curl --request POST \
--url https://api.example.com/api/v1/iframes/{id}/verify \
--header 'Content-Type: application/json' \
--data '
{
"domain": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/iframes/{id}/verify"
payload = { "domain": "<string>" }
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({domain: '<string>'})
};
fetch('https://api.example.com/api/v1/iframes/{id}/verify', 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.example.com/api/v1/iframes/{id}/verify",
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([
'domain' => '<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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/iframes/{id}/verify"
payload := strings.NewReader("{\n \"domain\": \"<string>\"\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.example.com/api/v1/iframes/{id}/verify")
.header("Content-Type", "application/json")
.body("{\n \"domain\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/iframes/{id}/verify")
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 \"domain\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"checks": [
{}
]
}運行一系列檢查並返回結果列表。如果未提供
domain,則只檢查小組件自身的配置(狀態、關聯的密鑰、域名允許列表)。如果提供了 domain,還會抓取該頁面以確認嵌入代碼是否存在,並檢查頁面的 Content-Security-Policy 中是否存在會阻止該小組件運行的指令。
身份驗證
需要提供 Bearer 令牌(API 密鑰)或儀表盤會話。路徑參數
string
必填
小組件配置的 UUID。
請求
string
要檢查的頁面 URL(可選)。提供後,系統會抓取該頁面(帶有 SSRF 防護)並掃描其中的嵌入代碼片段以及 CSP 相關問題。
響應
array
每項檢查包含:
name、status(pass | fail | warn)、message,以及可選的 fix 代碼片段(例如需要添加到你的站點中的 CSP 指令)。示例
curl
curl -X POST https://www.hitheo.ai/api/v1/iframes/CONFIG_ID/verify \
-H "Authorization: Bearer $THEO_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "domain": "https://example.com/contact" }'
這個頁面有幫助嗎?
驗證小組件安裝
curl --request POST \
--url https://api.example.com/api/v1/iframes/{id}/verify \
--header 'Content-Type: application/json' \
--data '
{
"domain": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/iframes/{id}/verify"
payload = { "domain": "<string>" }
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({domain: '<string>'})
};
fetch('https://api.example.com/api/v1/iframes/{id}/verify', 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.example.com/api/v1/iframes/{id}/verify",
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([
'domain' => '<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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/iframes/{id}/verify"
payload := strings.NewReader("{\n \"domain\": \"<string>\"\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.example.com/api/v1/iframes/{id}/verify")
.header("Content-Type", "application/json")
.body("{\n \"domain\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/iframes/{id}/verify")
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 \"domain\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"checks": [
{}
]
}