첨부 파일과 함께 생성 POST 유료
이미지 파일을 첨부한 푸시 알림을 보냅니다.
유료 기능
이 엔드포인트는 유료 플랜에서만 사용할 수 있습니다.
엔드포인트
POST https://api.pocketalert.app/v1/messages인증
필수
요청에 다음 헤더 중 하나를 포함하세요:
요청
헤더
| 헤더 | 필수 | 설명 |
|---|---|---|
Content-Type | ✅ | multipart/form-data |
Token | ✅ | API 키 |
본문 파라미터 (multipart/form-data)
| 파라미터 | 타입 | 필수 | 설명 |
|---|---|---|---|
title | string | ✅ | 알림 제목 |
message | string | ✅ | 알림 본문 텍스트 |
application_id | string | ❌ | 애플리케이션 TID |
device_id | string | ❌ | 기기 TID (전체 기기에 보내려면 생략) |
image | file | ❌ | 이미지 첨부 파일 (.png, .jpg, .jpeg, .gif) |
요청 예시
bash
curl -X POST "https://api.pocketalert.app/v1/messages" \
-H "Token: your-api-key" \
-F "title=Screenshot Alert" \
-F "message=New screenshot captured" \
-F "image=@/path/to/screenshot.png"javascript
const formData = new FormData();
formData.append('title', 'Screenshot Alert');
formData.append('message', 'New screenshot captured');
formData.append('image', fileInput.files[0]);
const response = await fetch('https://api.pocketalert.app/v1/messages', {
method: 'POST',
headers: { 'Token': 'your-api-key' },
body: formData
});python
import requests
with open('screenshot.png', 'rb') as f:
response = requests.post(
'https://api.pocketalert.app/v1/messages',
headers={'Token': 'your-api-key'},
data={
'title': 'Screenshot Alert',
'message': 'New screenshot captured'
},
files={'image': f}
)
print(response.json())php
$response = Http::withHeaders([
'Token' => 'your-api-key',
])->attach(
'image', file_get_contents('/path/to/screenshot.png'), 'screenshot.png'
)->post('https://api.pocketalert.app/v1/messages', [
'title' => 'Screenshot Alert',
'message' => 'New screenshot captured',
]);
return $response->json();응답
성공 응답
201 Created
첨부 파일이 포함된 메시지가 성공적으로 생성되었습니다
| 필드 | 타입 | 설명 |
|---|---|---|
tid | string | 메시지 고유 식별자 |
title | string | 메시지 제목 |
message | string | 메시지 본문 |
attachment | object | 첨부 파일 상세 정보 |
attachment.tid | string | 첨부 파일 식별자 |
attachment.file_name | string | 저장된 파일 이름 |
attachment.content_type | string | MIME 타입 |
attachment.file_size | integer | 파일 크기 (바이트) |
json
{
"tid": "zvtfxzk55fpqugz7ueslmse2a",
"title": "Screenshot Alert",
"message": "New screenshot captured",
"application": "Monitoring",
"device": "iPhone",
"created_at": "04.01.2025 09:12:08",
"attachment": {
"tid": "i6k4b8un79otbcbdkmavmf4ha",
"file_name": "5bd64bb3b76df1be1fc7f41eeb5078ca.jpg",
"content_type": "image/jpeg",
"file_size": 247421
}
}에러 응답
| 상태 코드 | 설명 |
|---|---|
401 | 인증 실패 — 토큰이 잘못되었거나 없습니다 |
403 | 권한 없음 — 이 기능은 유료 플랜이 필요합니다 |
400 | 잘못된 요청 — title 또는 message가 없거나, 지원하지 않는 파일입니다 |
404 | 찾을 수 없음 — application_id 또는 device_id가 존재하지 않습니다 |
429 | 일일 한도 도달 — 아무것도 저장되거나 업로드되지 않습니다. 일일 메시지 한도를 참고하세요. |