폼 수정 PUT
폼의 필드, 디자인, 설정을 교체합니다. 모든 필드가 그대로 적용되므로 일부만 보내지 말고 폼 전체를 보내 주세요.
엔드포인트
PUT https://api.pocketalert.app/v1/forms/{tid}인증
필수
요청에 다음 헤더 중 하나를 포함해 주세요:
요청
경로 매개변수
| 매개변수 | 타입 | 필수 | 설명 |
|---|---|---|---|
tid | string | ✅ | 폼 식별자 |
본문 매개변수
폼 생성과 동일합니다. 생략한 값은 기본값으로 초기화됩니다. allowed_origins를 생략하면 목록이 비워지고, application_tid를 생략하면 애플리케이션 연결이 해제됩니다.
현재 상태를 함께 보내세요
편집기는 폼을 불러온 뒤 필요한 부분만 바꾸고 결과를 다시 전송합니다. 변경된 키만 보내는 클라이언트는 나머지 값을 아무 경고 없이 지워 버릴 수 있습니다.
요청 예시
bash
curl -X PUT "https://api.pocketalert.app/v1/forms/vml19aihrga216gt8apc5e3m9" \
-H "Token: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"name": "Contact form",
"is_active": false,
"max_responses": 100,
"allowed_origins": ["example.com", "*.shop.example.com"],
"fields": [
{ "id": "name", "type": "text", "label": "Name", "required": true },
{ "id": "email", "type": "email", "label": "Email", "required": true }
],
"settings": { "title": "Get in touch" }
}'javascript
const tid = 'vml19aihrga216gt8apc5e3m9';
// Load the form, change one thing, send it all back.
const [form] = await fetch('https://api.pocketalert.app/v1/forms', {
headers: { 'Token': 'your-api-key' }
}).then((r) => r.json()).then((forms) => forms.filter((f) => f.tid === tid));
await fetch(`https://api.pocketalert.app/v1/forms/${tid}`, {
method: 'PUT',
headers: {
'Token': 'your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({ ...form, is_active: false })
});python
import requests
tid = 'vml19aihrga216gt8apc5e3m9'
headers = {'Token': 'your-api-key'}
forms = requests.get('https://api.pocketalert.app/v1/forms', headers=headers).json()
form = next(f for f in forms if f['tid'] == tid)
requests.put(
f'https://api.pocketalert.app/v1/forms/{tid}',
headers=headers,
json={**form, 'is_active': False}
)응답
성공 응답
200 OK
수정된 폼이 반환되며, 형식은 폼 생성과 같습니다.
오류 응답
| 상태 | 설명 |
|---|---|
400 | 유효성 검사 오류 — error 필드에 잘못된 부분이 표시됩니다 |
401 | 인증 실패 — 토큰이 잘못되었거나 없습니다 |
404 | 폼을 찾을 수 없거나 다른 계정의 폼입니다 |
500 | 폼 수정에 실패했습니다 |