ค้นหาอ่านตัวถังและชิ้นส่วน
วัตถุประสงค์: ค้นหาข้อมูลเมตาที่ซิงค์ จากนั้นดึงเนื้อหาแบบเต็มและเนื้อหาบางส่วนตามความต้องการ
โฟลว์ UI
- ผู้ใช้ค้นหาตามหัวเรื่อง/ผู้ส่ง
- UI โทร
/api/accounts/:account_id/emails/search - ผู้ใช้เปิดข้อความ
- UI เรียก
/bodyสำหรับข้อความที่แยกวิเคราะห์แบบเต็ม - UI เรียก
/partsจากนั้น/parts/:part_id/contentเพื่อดูตัวอย่างหรือดาวน์โหลดส่วนที่เลือก
โฟลว์ไลบรารีไคลเอนต์
const results = await api.emails.search(accountId, {
query: "invoice",
limit: 20,
});
const emailId = results.data[0]?.id;
if (emailId) {
const body = await api.emails.getBody(accountId, emailId);
const parts = await api.emails.listParts(accountId, emailId);
const firstPart = parts.data[0];
if (firstPart) {
await api.emails.getPartContent(accountId, emailId, firstPart.id);
}
}
HTTP/ขดไหล
API_BASE_URL="https://api.inbox-manager.com"
curl -sS -X POST "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}/emails/search" \
-H "authorization: Bearer ${BEARER_TOKEN}" \
-H "content-type: application/json" \
--data '{"query":"invoice","limit":20,"offset":0}'
curl -sS "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}/emails/${EMAIL_ID}/body" \
-H "authorization: Bearer ${BEARER_TOKEN}"
curl -sS "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}/emails/${EMAIL_ID}/parts" \
-H "authorization: Bearer ${BEARER_TOKEN}"
curl -sS "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}/emails/${EMAIL_ID}/parts/${PART_ID}/content" \
-H "authorization: Bearer ${BEARER_TOKEN}"
กรณีความขัดแย้งที่คาดหวัง
409 email_part_content_hash_mismatch409 email_part_metadata_out_of_sync
สคริปต์การตรวจสอบ
scripts/provider_parts_content_flow.sh