API Reference · 컨텐츠

콘텐츠 이벤트 발생

콘텐츠사가 사용자 이벤트 달성을 보고합니다. v2 부터 엔드포인트는 content_id 단위이며 body 의 event_type 으로 캠페인 이벤트와 자동 매칭합니다.

POST/api/v1/contents/{content_id}/events

요청 파라미터

  • content_id (path, uuid, required) — 이벤트가 발생한 콘텐츠 ID.
  • session_id (body, uuid, required) — 게이트웨이로부터 받은 세션 식별자.
  • event_type (body, string, required) — 이벤트 유형 키 (예: start, complete, level_up). 캠페인에 등록된 이벤트와 동일한 키여야 매칭됩니다.
  • value (body, number, optional) — 이벤트 값 (점수·레벨 등). 캠페인 이벤트 정의에 따라 사용.
  • occurred_at (body, ISO 8601, optional) — 발생 시각. 생략 시 서버 시각 사용.

요청예시

shell
curl -X POST "https://added.blomics.net/api/v1/contents/{content_id}/events" \
  -H "Authorization: Bearer {provider_secret}" \
  -H "Content-Type: application/json" \
  -d '{
    "session_id": "0192...",
    "event_type": "complete",
    "value": 100
  }'

응답 필드

200 OK — 매칭된 캠페인 이벤트별 결과를 배열로 반환합니다. 매칭 0개도 정상 200 (legs: []).

  • summary (object) —
    • matched_count (int) — 보상 지급된 캠페인 수.
    • rejected_count (int) — 거부된 캠페인 수.
  • legs (array) — 캠페인별 처리 결과.
    • campaign_id (uuid) — 매칭된 캠페인.
    • event_id (uuid) — 매칭된 캠페인 이벤트 정의.
    • point (int) — 지급 포인트 (지급 시).
    • reject_reason (string, nullable) — 거부 사유 (한도 초과, 캠페인 종료, 중복 등).

응답예시

json
{
  "summary": { "matched_count": 1, "rejected_count": 0 },
  "legs": [
    {
      "campaign_id": "0193a1b2-3c4d-5e6f-7890-abcdef012345",
      "event_id": "0194b1c2-3c4d-5e6f-7890-abcdef012345",
      "point": 100,
      "reject_reason": null
    }
  ]
}

에러처리

  • 400 INVALID_PARAM — body 형식 오류, 필수 필드 누락.
  • 401 UNAUTHORIZED — 인증 실패.
  • 404 NOT_FOUND — 콘텐츠 없음, 세션 만료/없음.
  • 409 DUPLICATE — 동일 (session, event_type) 중복.
  • 500 INTERNAL_ERROR — 서버 오류.