WebMethod.Type เป็นชุดค่าคงที่สำหรับระบุ HTTP method (GET/POST/PUT/DELETE/PATCH/HEAD) โดยค่าพวกนี้จะถูกใช้ในบริบทของ Custom Connector เพื่อกำหนดว่า “คำขอ HTTP” ต้องการทำอะไรกับปลายทาง เช่น ดึงข้อมูล (GET) หรือส่งข้อมูล (POST)
=WebMethod.Get | WebMethod.Post | WebMethod.Put | WebMethod.Delete | WebMethod.Patch | WebMethod.Head
=WebMethod.Get | WebMethod.Post | WebMethod.Put | WebMethod.Delete | WebMethod.Patch | WebMethod.Head
ใช้ WebMethod.* เพื่อระบุว่าเรียก API แบบ GET/POST/PUT ตามประเภทของงาน เช่น ดึงข้อมูลหรือส่งข้อมูล
let Request = [Method = WebMethod.Get, Url = "https://api.example.com/customers"] in Request[Method]let Request = [Method = WebMethod.Get, Url = "https://api.example.com/customers"] in Request[Method]
"GET"
let Request = [Method = WebMethod.Post, Url = "https://api.example.com/orders", Content = "{ \"id\": 1 }"] in Request[Method]let Request = [Method = WebMethod.Post, Url = "https://api.example.com/orders", Content = "{ \"id\": 1 }"] in Request[Method]
"POST"
let IsUpdate = true, Method = if IsUpdate then WebMethod.Put else WebMethod.Post in Methodlet IsUpdate = true, Method = if IsUpdate then WebMethod.Put else WebMethod.Post in Method
"PUT"
ตามเอกสาร Microsoft Learn ค่ากลุ่ม WebMethod.* ใช้งานได้ในบริบทของ Custom Connector เป็นหลัก ไม่ได้หมายความว่าใช้โดยตรงได้กับทุกฟังก์ชันเว็บทั่วไปใน Power Query
โดยทั่วไป GET ใช้ดึงข้อมูล, POST ใช้ส่งข้อมูลเพื่อสร้างรายการ, PUT ใช้อัปเดต, DELETE ใช้ลบ และ PATCH ใช้อัปเดตบางส่วน แต่ขึ้นกับข้อกำหนดของ API ปลายทางด้วย
WebMethod.Type คือชุดค่าคงที่สำหรับระบุ HTTP method (เช่น GET/POST/PUT/DELETE) ในบริบทของการทำ Custom Connector (Power Query M extension) เพื่อกำหนดวิธีส่งคำขอไปยัง API/เว็บเซอร์วิส