POST /api/update
하나 이상의 실시간 현황에 표시되는 내용을 바꿔요.
바뀌는 필드만 보내세요. 저장된 상태에 병합되므로, primaryText만 보내면 나머지는 그대로예요. 상태 객체를 참고하세요.
대상
모든 호출에는 widgetContainerId 값과 다음 중 하나가 들어가요:
activityId: 실시간 현황 하나.activityIds: 실시간 현황 목록.group: 그룹의 모든 실시간 현황.
지정한 id가 컨테이너에 하나도 없으면 404로 응답해요. 실시간 현황이 없는 그룹은 200와 targeted: 0로 응답해요.
실시간 현황 id로
1 2 3 4 5 6 7 8 9 10 11 12 13
curl -X POST https://api.webliveactivity.com/api/update \ -H 'Content-Type: application/json' \ -H 'x-api-key: wla_your_key' \ -d '{ "activityId": "act-8f2cqa4mx7rd", "widgetContainerId": "acme-orders", "state": { "primaryText": "Out for delivery", "stage": "On the way", "progress": 0.7, "estimatedMinutes": 8 } }'
여러 실시간 현황 id로
1 2 3 4 5 6 7 8 9 10 11 12 13
curl -X POST https://api.webliveactivity.com/api/update \ -H 'Content-Type: application/json' \ -H 'x-api-key: wla_your_key' \ -d '{ "activityIds": [ "act-8f2cqa4mx7rd", "act-9k4d2bwh6tne" ], "widgetContainerId": "acme-orders", "state": { "secondaryText": "Running behind schedule" } }'
그룹으로
1 2 3 4 5 6 7 8 9 10
curl -X POST https://api.webliveactivity.com/api/update \ -H 'Content-Type: application/json' \ -H 'x-api-key: wla_your_key' \ -d '{ "group": "order-tracker", "widgetContainerId": "acme-orders", "state": { "secondaryText": "Kitchen is busy tonight" } }'
응답
targeted 값은 업데이트를 보낸 실시간 현황 수예요. unknown에는 이 컨테이너에서 찾지 못한 id가 담겨요.
1 2 3 4 5
{ "ok": true, "targeted": 3, "unknown": [] }
예시
조용한 업데이트
모든 업데이트는 primaryText 값을 제목으로, secondaryText 값을 본문으로 해서 휴대폰에 알림을 울려요. priority에는 10(기본값) 또는 5를 넣을 수 있어요. 조용한 업데이트는 priority: 5로 보내세요. iPhone에서는 알림이 없고 Android에서는 소리가 나지 않아요. 다른 값은 10으로 처리돼요. 타이밍과 요금은 전송 및 요금을 참고하세요.
1 2 3 4 5 6 7 8 9 10 11 12
curl -X POST https://api.webliveactivity.com/api/update \ -H 'Content-Type: application/json' \ -H 'x-api-key: wla_your_key' \ -d '{ "activityId": "act-8f2cqa4mx7rd", "widgetContainerId": "acme-orders", "priority": 5, "state": { "progress": 0.8, "estimatedMinutes": 4 } }'
구간형 단계 진행하기
새 complete 값을 넣은 segments 목록 전체를 보내세요. 목록은 병합되지 않고 통째로 교체돼요.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
curl -X POST https://api.webliveactivity.com/api/update \ -H 'Content-Type: application/json' \ -H 'x-api-key: wla_your_key' \ -d '{ "activityId": "act-8f2cqa4mx7rd", "widgetContainerId": "pizza-tracker", "state": { "primaryText": "On the way", "segments": [ { "label": "Cooking", "complete": true }, { "label": "On the way", "complete": false }, { "label": "Delivered", "complete": false } ] } }'
대결 점수 업데이트하기
versus 객체는 한 단계 아래까지 병합되니, 바뀐 것만 보내세요.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
curl -X POST https://api.webliveactivity.com/api/update \ -H 'Content-Type: application/json' \ -H 'x-api-key: wla_your_key' \ -d '{ "activityId": "act-8f2cqa4mx7rd", "widgetContainerId": "csgo-scores", "state": { "versus": { "leftScore": "16", "rightScore": "14", "activeSide": "left", "leftStatus": "Winner" } } }'
레이아웃 바꾸기
새 layout 값과 그 레이아웃의 필드를 보내세요. 카드 유형이 바뀌어요.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
curl -X POST https://api.webliveactivity.com/api/update \ -H 'Content-Type: application/json' \ -H 'x-api-key: wla_your_key' \ -d '{ "activityId": "act-8f2cqa4mx7rd", "widgetContainerId": "acme-orders", "state": { "layout": "countdown", "primaryText": "Ready for pickup", "secondaryText": "Pickup closes in", "countdownTo": 1795046400, "completionText": "Pickup closed" } }'
카드 재시작하기
재시작은 카드를 그 자리에서 바꾸지 않고 새로 만들어요. 재시작은 항상 알림을 울리고 priority를 무시해요. 다음 경우에 업데이트가 재시작으로 전송돼요:
restart: true설정이 있을 때,- 새 이미지 URL을 추가할 때(iPhone이 먼저 이미지를 다운로드해야 해요), 또는
- 카드가 시작된 지 8시간이 넘었을 때(iOS는 8시간이 지나면 일반 업데이트를 받지 않아요).
사용자가 밀어서 없앤 카드나 종료된 카드를 다시 띄우려면 restart: true를 쓰세요. 일반 업데이트로는 안 돼요. state 없이 보내면 저장된 상태로 카드가 재시작돼요.
1 2 3 4 5 6 7 8
curl -X POST https://api.webliveactivity.com/api/update \ -H 'Content-Type: application/json' \ -H 'x-api-key: wla_your_key' \ -d '{ "activityId": "act-8f2cqa4mx7rd", "widgetContainerId": "acme-orders", "restart": true }'
이미지 URL은 호출마다 같게 유지하세요. 쿼리 문자열이 바뀌는 URL은 새 이미지로 취급되어, 업데이트할 때마다 카드가 재시작돼요.









