Skip to Content
🚀 Welcome to Humansoft Open API Documentation

Delete OT

ลบคำขอ OT

ใช้ API นี้เพื่อลบคำขอ OT ที่ยื่นผิดพลาดหรือไม่ต้องการแล้ว ระบบจะทำการลบข้อมูล

Endpoint

POST /api/v1/open-apis/overtime/delete

Request Parameters

ParameterTypeRequiredDescriptionExample
ot_work_idstringYesID ของคำขอที่ต้องการลบT1QwMDEyMw==

Request Body Example

{ "ot_work_id": "T1QwMDEyMw==" }

Response Format

Success Response (HTTP 200)

{ "code": 200, "message": "ลบเอกสารสำเร็จ", "payload": { "ot_work_id": "T1QwMDEyMw==", "employee_id": "RU1QMDE=", "ot_work_dt": "2026-01-15", "deleted_at": "2026-01-13 14:30:00" } }

Error Response - Not Found (HTTP 400)

{ "code": 400, "message": "ไม่สำเร็จ", "error": "OT work record not found" }

Error Response - Already Deleted (HTTP 400)

{ "code": 400, "message": "ไม่สำเร็จ", "error": "OT work record already deleted" }

Error Response - Salary Period Closed (HTTP 400)

{ "code": 400, "message": "ไม่สำเร็จ", "error": "ไม่สามารถลบได้ งวดเงินเดือนปิดแล้ว" }

Response Fields

FieldTypeDescription
ot_work_idstringID ของคำขอที่ลบ
employee_idstringID ของพนักงาน
ot_work_dtstringวันที่ทำ OT
deleted_atdatetimeวันเวลาที่ลบ

Code Examples

curl -X POST "https://openapi.humansoft.co.th/api/v1/open-apis/overtime/delete" \ -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "ot_work_id": "T1QwMDEyMw==" }'

Validation Rules

ParameterValidationError Message
ot_work_idต้องระบุและเป็น stringMissing required parameter: 'ot_work_id'

Business Rules

ข้อจำกัดการลบ:

  • ไม่สามารถลบคำขอที่ลบไปแล้ว
  • ไม่สามารถลบในงวดเงินเดือนที่ปิดแล้ว
  • การลบคำขอจะเปลี่ยนสถานะข้อมูล สามารถตรวจสอบผลลัพธ์ได้จาก response
  • Feed และ notifications ที่เกี่ยวข้องจะถูกลบด้วย

Error Handling

ErrorCauseSolution
Missing required parameter: 'ot_work_id'ไม่ได้ส่ง ot_work_idตรวจสอบ request body
OT work record not foundไม่พบคำขอตรวจสอบ ot_work_id
OT work record already deletedคำขอถูกลบไปแล้วไม่ต้องดำเนินการ
ไม่สามารถลบได้ งวดเงินเดือนปิดแล้วงวดเงินเดือนปิดแล้วติดต่อ HR

Notes

Use Cases

  1. ยกเลิกคำขอผิดพลาด - ลบคำขอที่ยื่นผิดวันหรือผิดประเภท
  2. ทำความสะอาดข้อมูล - ลบคำขอที่ไม่ต้องการแล้ว
  3. แก้ไขข้อมูล - ลบคำขอเดิมก่อนสร้างใหม่ (กรณีไม่สามารถ update ได้)
  • Get OT List - ดึงรายการคำขอ OT
  • Submit OT - ยื่นคำขอ OT ใหม่
  • Update OT - แก้ไขคำขอ OT
Last updated on