웹훅 업데이트 PUT
웹훅의 이름, 메시지 템플릿, 기본 중요도, 액션 버튼, 활성 상태를 업데이트해요. 생략한 필드는 현재 값을 그대로 유지해요.
엔드포인트
PUT https://api.pocketalert.app/v1/webhooks/{tid}인증
필수
요청에 다음 헤더 중 하나를 포함하세요:
요청
경로 파라미터
| 파라미터 | 타입 | 필수 | 설명 |
|---|---|---|---|
tid | string | ✅ | 웹훅 고유 식별자 |
헤더
| 헤더 | 필수 | 설명 |
|---|---|---|
Token | ✅ | API 키 |
Authorization | ✅ | Bearer <jwt-token> |
본문 파라미터
| 파라미터 | 타입 | 필수 | 설명 |
|---|---|---|---|
name | string | ❌ | 새 이름 |
url | string | ❌ | 수신 URL https://p4a.me/wh/{url}의 새 슬러그예요. 기존 URL은 더 이상 작동하지 않아요. 이미 사용 중인 슬러그라면 409를 반환해요 |
message | string | ❌ | 새 메시지 템플릿 |
is_active | boolean | ❌ | 웹훅 활성화/비활성화 |
application_id | string | ❌ | 새 애플리케이션 TID |
device_id | string | ❌ | 새 기기 TID |
default_level | string | int | null | ❌ | 페이로드에 level이 없을 때 이 웹훅이 보내는 메시지의 기본 우선순위예요. 이름(silent…critical) 또는 정수(-2..2)를 사용할 수 있어요. null로 설정하면 제거되어 애플리케이션의 중요도가 적용돼요 |
actions | string | ❌ | %field.path% 플레이스홀더를 포함한 JSON 액션 버튼 템플릿이에요. 자세한 내용은 웹훅 생성을 참고하세요. ""를 입력하면 버튼이 제거돼요 |
웹훅 비활성화
is_active: false인 웹훅도 수신 요청을 받고 200으로 응답해요. 하지만 알림은 생성되지 않아요. 이런 호출은 웹훅 기록에 error_code: inactive로 남아요.
요청 예시
bash
curl -X PUT "https://api.pocketalert.app/v1/webhooks/kblf7mh9j8jjyeh4fx" \
-H "Token: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"name": "GitHub Push (Inactive)",
"is_active": false
}'javascript
const tid = 'kblf7mh9j8jjyeh4fx';
const response = await fetch(`https://api.pocketalert.app/v1/webhooks/${tid}`, {
method: 'PUT',
headers: {
'Token': 'your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'GitHub Push (Inactive)',
is_active: false
})
});python
import requests
tid = 'kblf7mh9j8jjyeh4fx'
response = requests.put(
f'https://api.pocketalert.app/v1/webhooks/{tid}',
headers={'Token': 'your-api-key'},
json={'name': 'GitHub Push (Inactive)', 'is_active': False}
)
print(response.json())php
$tid = 'kblf7mh9j8jjyeh4fx';
$response = Http::withHeaders([
'Token' => 'your-api-key',
])->put('https://api.pocketalert.app/v1/webhooks/'.$tid, [
'name' => 'GitHub Push (Inactive)',
'is_active' => false,
]);
return $response->json();응답
성공 응답
200 OK
웹훅이 성공적으로 업데이트되었어요
json
{
"data": "success"
}오류 응답
| 상태 | 설명 |
|---|---|
400 | 잘못된 요청 — 잘못된 default_level 또는 actions 템플릿이거나, name 또는 message가 비어 있어요 |
401 | 인증 실패 — 토큰이 잘못되었거나 없어요 |
404 | 찾을 수 없음 — 웹훅, 애플리케이션 또는 기기가 존재하지 않아요 |
409 | 충돌 — url 슬러그가 이미 사용 중이에요 |