인증
모든 API 요청에는 인증을 위한 Bearer 토큰 (API 키)이 필요합니다.
API 키 생성
- app.ironflock.com에서 IronFlock에 로그인합니다.
- User Settings으로 이동합니다.
- API Keys 섹션으로 이동합니다.
- Create API Key를 클릭합니다.
- 생성된 키를 복사합니다 — 한 번만 표시됩니다.
API 키 사용
모든 요청의 Authorization 헤더에 키를 포함합니다:
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://api.ironflock.com/v1/ironflock/devicesPython 예시
import requests
API_KEY = "your-api-key"
BASE_URL = "https://api.ironflock.com/v1/ironflock"
headers = {"Authorization": f"Bearer {API_KEY}"}
response = requests.get(f"{BASE_URL}/devices", headers=headers)
devices = response.json()JavaScript 예시
const API_KEY = "your-api-key";
const BASE_URL = "https://api.ironflock.com/v1/ironflock";
const response = await fetch(`${BASE_URL}/devices`, {
headers: { Authorization: `Bearer ${API_KEY}` }
});
const devices = await response.json();오류 응답
| 상태 코드 | 의미 |
|---|---|
401 | API 키가 없거나 유효하지 않음 |
403 | 이 작업에 대한 권한 부족 |
404 | 리소스를 찾을 수 없음 |
422 | 유효성 검사 오류 (요청 파라미터 확인) |
500 | 내부 서버 오류 |
모든 오류 응답은 JSON 객체를 반환합니다:
{
"error": "오류 설명"
}Last updated on