Skip to content

Create devcontainer.json #6114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Create devcontainer.json #6114

wants to merge 1 commit into from

Conversation

loveyou001
Copy link

ตัวอย่างข้อมูลจำเพาะของ 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 หรือ Service
  • api-version: เวอร์ชันของ API

2. Method
HTTP Method ที่ใช้ เช่น

  • GET: ใช้สำหรับดึงข้อมูล
  • POST: ใช้สำหรับสร้างทรัพยากร
  • PUT: ใช้สำหรับอัปเดตทรัพยากร
  • DELETE: ใช้สำหรับลบทรัพยากร

ตัวอย่าง:

GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}?api-version=2021-02-01

3. Headers
ส่วนหัวที่ต้องกำหนด เช่น

  • Authorization: ใช้ระบุ Bearer Token สำหรับการยืนยันตัวตน
  • Content-Type: ระบุประเภทของข้อมูล เช่น application/json

ตัวอย่าง:

Authorization: Bearer <access_token>
Content-Type: application/json

4. Request Body
ข้อมูลที่ส่งไปในกรณีที่ใช้ Method เช่น POST หรือ PUT
ตัวอย่าง Request Body:

{
  "location": "East US",
  "properties": {
    "serverFarmId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}"
  }
}

5. Response
ผลลัพธ์ที่ได้จากการเรียก API จะอยู่ในรูปแบบ JSON
ตัวอย่าง Response:

{
  "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}",
  "name": "{name}",
  "type": "Microsoft.Web/sites",
  "location": "East US",
  "properties": {
    "state": "Running",
    "hostNames": ["example.azurewebsites.net"]
  }
}

ตัวอย่างการเรียกใช้งานจริง (ด้วย cURL)

curl -X GET \
  -H "Authorization: Bearer <access_token>" \
  -H "Content-Type: application/json" \
  "https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}?api-version=2021-02-01"

สำหรับข้อมูลเพิ่มเติม สามารถศึกษาได้จาก Azure REST API Reference ซึ่งมีรายละเอียดเกี่ยวกับ API แต่ละประเภทที่ Azure รองรับ

Copy link
Contributor

Thank you for your contribution @loveyou001! We will review the pull request and get back to you soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant