Webhookを作成 (v3)
curl --request POST \
--url https://api.bizmori.com/api/v3/orders/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://example.com/webhook",
"subscribedEvents": [],
"name": "<string>"
}
'import requests
url = "https://api.bizmori.com/api/v3/orders/webhooks"
payload = {
"url": "https://example.com/webhook",
"subscribedEvents": [],
"name": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: 'https://example.com/webhook', subscribedEvents: [], name: '<string>'})
};
fetch('https://api.bizmori.com/api/v3/orders/webhooks', 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.bizmori.com/api/v3/orders/webhooks",
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([
'url' => 'https://example.com/webhook',
'subscribedEvents' => [
],
'name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.bizmori.com/api/v3/orders/webhooks"
payload := strings.NewReader("{\n \"url\": \"https://example.com/webhook\",\n \"subscribedEvents\": [],\n \"name\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.bizmori.com/api/v3/orders/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://example.com/webhook\",\n \"subscribedEvents\": [],\n \"name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bizmori.com/api/v3/orders/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://example.com/webhook\",\n \"subscribedEvents\": [],\n \"name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"webhookId": 123,
"name": "<string>",
"url": "<string>",
"secret": "<string>",
"isTest": true,
"isActive": true,
"subscribedEvents": [
"<string>"
],
"lastSentAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"code": "AUTH_NOT_AUTHENTICATED"
}Webhooks
Webhookを作成 (v3)
空でも重複でもないsubscribedEventsの一覧を指定して登録します。対応する値はevent-typesで取得できます。テストキーではisTest=trueが強制され、falseを明示するとAUTH_FORBIDDENになります。登録レスポンスには署名用secretが含まれます。安全に保管してください。詳細取得でも確認できます。
POST
/
api
/
v3
/
orders
/
webhooks
Webhookを作成 (v3)
curl --request POST \
--url https://api.bizmori.com/api/v3/orders/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://example.com/webhook",
"subscribedEvents": [],
"name": "<string>"
}
'import requests
url = "https://api.bizmori.com/api/v3/orders/webhooks"
payload = {
"url": "https://example.com/webhook",
"subscribedEvents": [],
"name": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: 'https://example.com/webhook', subscribedEvents: [], name: '<string>'})
};
fetch('https://api.bizmori.com/api/v3/orders/webhooks', 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.bizmori.com/api/v3/orders/webhooks",
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([
'url' => 'https://example.com/webhook',
'subscribedEvents' => [
],
'name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.bizmori.com/api/v3/orders/webhooks"
payload := strings.NewReader("{\n \"url\": \"https://example.com/webhook\",\n \"subscribedEvents\": [],\n \"name\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.bizmori.com/api/v3/orders/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://example.com/webhook\",\n \"subscribedEvents\": [],\n \"name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bizmori.com/api/v3/orders/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://example.com/webhook\",\n \"subscribedEvents\": [],\n \"name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"webhookId": 123,
"name": "<string>",
"url": "<string>",
"secret": "<string>",
"isTest": true,
"isActive": true,
"subscribedEvents": [
"<string>"
],
"lastSentAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"code": "AUTH_NOT_AUTHENTICATED"
}curl -X POST "$CONTENTCARE_API_BASE_URL/api/v3/orders/webhooks" \
-H "Authorization: Bearer $CONTENTCARE_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"ContentCare webhook","url":"https://your-server.com/webhook","subscribedEvents":["order.watermarkEmbed.completed","order.watermarkEmbed.failed"]}'
const response = await fetch(`${process.env.CONTENTCARE_API_BASE_URL}/api/v3/orders/webhooks`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CONTENTCARE_API_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "ContentCare webhook",
url: "https://your-server.com/webhook",
subscribedEvents: ["order.watermarkEmbed.completed", "order.watermarkEmbed.failed"],
}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const webhook = await response.json(); // signing secret: webhook.data.secret
import os
import requests
response = requests.post(
f"{os.environ['CONTENTCARE_API_BASE_URL']}/api/v3/orders/webhooks",
headers={"Authorization": f"Bearer {os.environ['CONTENTCARE_API_TOKEN']}"},
json={
"name": "ContentCare webhook",
"url": "https://your-server.com/webhook",
"subscribedEvents": ["order.watermarkEmbed.completed", "order.watermarkEmbed.failed"],
},
timeout=30,
)
response.raise_for_status()
webhook = response.json() # signing secret: webhook["data"]["secret"]
承認
ボディ
application/json
必須です。空の一覧や重複するイベントは指定できません。
Minimum array length:
1利用可能なオプション:
order.antiAi.completed, order.antiAi.failed, order.watermarkEmbed.completed, order.watermarkEmbed.failed, order.watermarkExtract.completed, order.watermarkExtract.failed, order.aiDetection.completed, order.aiDetection.failed レスポンス
成功