ข้ามไปยังเนื้อหา

ข้อมูลอ้างอิง payload ของ Webhook

เนื้อหา JSON ที่ Timemark ส่งด้วย POST สำหรับอีเวนต์ภาพถ่ายใหม่ อธิบายทีละฟิลด์


คุณกำลังเขียน endpoint ที่รับ webhook จาก Timemark และต้องการทราบโครงสร้างที่แน่นอนของเนื้อหาคำขอเพื่อนำไปแยกวิเคราะห์

การส่งข้อมูลแต่ละครั้งคือคำขอ HTTP POST ที่มีเนื้อหาเป็น JSON เนื้อหานี้บรรจุอีเวนต์และภาพถ่ายที่เกี่ยวข้อง endpoint ของคุณต้องตอบกลับด้วยสถานะ 2xx ภายในเวลาที่กำหนด มิฉะนั้นจะถือว่าเป็นการส่งข้อมูลที่ล้มเหลวและจะถูกส่งซ้ำ

นี่คือเนื้อหาที่ส่งสำหรับอีเวนต์ ภาพถ่ายใหม่ (event_type: "photo.uploaded"):

{
"event_type": "photo.uploaded",
"event_id": "3f4566da-938d-4e11-834b-ba9e3faec98c",
"group_name": "Group Scenery",
"project_name": "Project Sunrise",
"photo_code": "A1BCDEFGHIJ23K",
"photo_name": "2025-12-11 13.45.00_1388 Central Park, New York, example.jpg",
"photo_url": "https://example.com/uploads/photos/123456.jpg",
"thumbnail_url": "https://example.com/uploads/photos/123456.jpg",
"photo_timestamp": "2025-12-11T13:45:00Z",
"photo_location": {
"location_name": "Central Park, New York, USA",
"location_latitude": "40.785091",
"location_longitude": "-73.968285"
},
"member": {
"member_name": "Alice Chen",
"member_short_name": "Alice",
"member_profile_picture_url": "https://example.com/user/profile_photo/123456.jpg",
"member_contact": "alice.chen@example.com"
},
"device_model": "Apple iPhone 14 Pro Max",
"custom_notes": [
{
"title": "custom_note_title_1",
"content": "custom_note_content_1"
},
{
"title": "custom_note_title_2",
"content": "custom_note_content_2"
}
]
}
ฟิลด์ประเภทคำอธิบาย
event_typestringอีเวนต์ที่ทำงาน คือ photo.uploaded สำหรับอีเวนต์ภาพถ่ายใหม่
event_idstringรหัสเฉพาะของการส่งข้อมูลครั้งนี้ ใช้เพื่อกำจัดข้อมูลซ้ำเมื่อมีการส่งซ้ำ
group_namestringทีมที่ภาพถ่ายนี้เป็นของ
project_namestringโปรเจกต์ที่ภาพถ่ายนี้เป็นของ
photo_codestringรหัสยืนยันของภาพถ่าย ใช้ใน Photo Verification Center ด้วย
photo_namestringชื่อไฟล์ของภาพถ่าย รวมเวลาและสถานที่ที่ถ่าย
photo_urlstringURL ของภาพขนาดเต็ม
thumbnail_urlstringURL ของภาพขนาดย่อ
photo_timestampstringเวลาที่ถ่ายในรูปแบบ ISO 8601 (UTC)
photo_locationobjectตำแหน่งที่ถ่าย ดูรายละเอียดด้านล่าง
photo_location.location_namestringชื่อสถานที่หรือที่อยู่ที่อ่านเข้าใจง่าย
photo_location.location_latitudestringละติจูด ในรูปแบบสตริง
photo_location.location_longitudestringลองจิจูด ในรูปแบบสตริง
memberobjectสมาชิกที่ถ่ายภาพนี้ ดูรายละเอียดด้านล่าง
member.member_namestringชื่อที่แสดงแบบเต็ม
member.member_short_namestringชื่อแบบย่อ
member.member_profile_picture_urlstringURL ของรูปโปรไฟล์สมาชิก
member.member_contactstringช่องทางติดต่อของสมาชิก เช่น อีเมล
device_modelstringอุปกรณ์ที่ใช้ถ่ายภาพนี้
custom_notesarrayบันทึกย่อกำหนดเองบนภาพถ่าย แต่ละรายการมี title และ content
  • ละติจูดและลองจิจูดเป็นสตริง ไม่ใช่ตัวเลข ต้องแปลงประเภทข้อมูลก่อนนำไปคำนวณ
  • กำจัดข้อมูลซ้ำโดยอิง event_id การส่งข้อมูลที่ถูกส่งซ้ำจะมี event_id เดิม จึงควรเก็บค่านี้ไว้แล้วข้ามรายการที่ซ้ำ
  • ตอบกลับให้เร็ว แล้วค่อยประมวลผลทีหลัง ให้ตอบกลับด้วย 2xx ก่อน แล้วจึงทำงานหนักในภายหลัง มิฉะนั้นการส่งข้อมูลจะถูกถือว่าล้มเหลวและถูกส่งซ้ำ

อัปเดตล่าสุด: