Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ตัวอย่างข้อมูลจำเพาะของ Azure REST API สามารถดูได้จากเอกสารที่ Microsoft จัดทำไว้ โดยมีโครงสร้างของ API ที่ใช้ในการสื่อสารระหว่างระบบผ่าน HTTP ซึ่งมักจะประกอบด้วยองค์ประกอบต่อไปนี้:
ตัวอย่างข้อมูลจำเพาะ Azure REST API
1. Endpoint URL
URL ที่ใช้เรียก API เช่น
https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}?api-version=2021-02-01
{subscriptionId}
: รหัส Subscription ใน Azure{resourceGroupName}
: ชื่อ Resource Group{name}
: ชื่อ Resource หรือ Serviceapi-version
: เวอร์ชันของ API2. Method
HTTP Method ที่ใช้ เช่น
GET
: ใช้สำหรับดึงข้อมูลPOST
: ใช้สำหรับสร้างทรัพยากรPUT
: ใช้สำหรับอัปเดตทรัพยากรDELETE
: ใช้สำหรับลบทรัพยากรตัวอย่าง:
3. Headers
ส่วนหัวที่ต้องกำหนด เช่น
Authorization
: ใช้ระบุ Bearer Token สำหรับการยืนยันตัวตนContent-Type
: ระบุประเภทของข้อมูล เช่นapplication/json
ตัวอย่าง:
4. Request Body
ข้อมูลที่ส่งไปในกรณีที่ใช้ Method เช่น
POST
หรือPUT
ตัวอย่าง Request Body:
5. Response
ผลลัพธ์ที่ได้จากการเรียก API จะอยู่ในรูปแบบ JSON
ตัวอย่าง Response:
ตัวอย่างการเรียกใช้งานจริง (ด้วย cURL)
สำหรับข้อมูลเพิ่มเติม สามารถศึกษาได้จาก Azure REST API Reference ซึ่งมีรายละเอียดเกี่ยวกับ API แต่ละประเภทที่ Azure รองรับ