แชร์ผ่าน


MICROSOFT Fabric data pipeline public REST API (ตัวอย่าง)

สำคัญ

Microsoft Fabric API สําหรับ Data Factory ขณะนี้อยู่ในตัวอย่างสาธารณะ ข้อมูลนี้เกี่ยวข้องกับผลิตภัณฑ์ก่อนวางจําหน่ายที่อาจได้รับการปรับเปลี่ยนแล้วมากก่อนที่จะมีการเผยแพร่ Microsoft ไม่มีการรับประกันใดๆ ไม่ว่าจะระบุหรือโดยนัย แก่ข้อมูลที่ให้ไว้ที่นี่

ใน Microsoft Fabric, Data Factory API ประกอบด้วยการดําเนินการ CRUD สําหรับไปป์ไลน์และกระแสข้อมูลเท่านั้น ในปัจจุบัน รองรับเฉพาะไปป์ไลน์ข้อมูลเท่านั้น ระบบจะเผยแพร่ API ของกระแสข้อมูลในภายหลัง พื้นที่ทั่วไปอื่น ๆ สําหรับโครงการการรวมข้อมูลอยู่ใน API ที่แยกต่างหาก: กําหนดการ การตรวจสอบ การเชื่อมต่อ มี API ของตนเองใน Fabric เอกสารอ้างอิงออนไลน์หลักสําหรับ Microsoft Fabric REST API สามารถพบได้ใน การอ้างอิง Microsoft Fabric REST API นอกจากนี้โปรดดูที่ API รายการหลักและ ตัวจัดกําหนดการงาน

รับโทเค็นการรับรองความถูกต้อง

ตัวเลือกที่ 1: การใช้ MSAL.Net

การเริ่มต้นใช้งานด่วน Fabric API - Microsoft Fabric REST API

ใช้ MSAL.Net เพื่อรับโทเค็น Microsoft Entra ID สําหรับบริการ Fabric ด้วยขอบเขตต่อไปนี้: Workspace.ReadWrite.All, Item.ReadWrite.All สําหรับข้อมูลเพิ่มเติมเกี่ยวกับการรับโทเค็นที่มี MSAL.Net ดู Token Acquisition - ไลบรารีการรับรองความถูกต้องของ Microsoft สําหรับ .NET

วาง ID แอปพลิเคชัน (ไคลเอนต์) ที่คุณคัดลอกก่อนหน้านี้และวางสําหรับตัวแปร ClientId

ตัวเลือกที่ 2: การใช้พอร์ทัล Fabric

ลงชื่อเข้าใช้ Fabric Portal สําหรับผู้เช่าที่คุณต้องการทดสอบ และกด F12 เพื่อเข้าสู่โหมดนักพัฒนาของเบราว์เซอร์ ในคอนโซลให้เรียกใช้:

powerBIAccessToken

คัดลอกโทเค็นและวางสําหรับตัวแปร ClientId

ข้อกําหนดรายการที่มีการเข้ารหัสเพย์โหลด 64

  • ใช้ การเข้ารหัสและถอดรหัส Base64 เพื่อเข้ารหัส JSON ของคุณ
  • ตรวจสอบให้แน่ใจว่า กล่องดําเนินการเข้ารหัส URL ที่ปลอดภัยไม่ได้ถูกเลือกไว้
  • คุณสามารถรับข้อกําหนดไปป์ไลน์ได้ผ่านแท็บโค้ด View -->View JSON ในส่วนติดต่อผู้ใช้ Fabric
{ 
    "name": "Pipeline_1_updated", 
    "objectId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", 
    "properties": { 
        "description": "this is the description", 
        "activities": [ 
            { 
                "name": "Wait1", 
                "type": "Wait", 
                "dependsOn": [], 
                "typeProperties": { 
                    "waitTimeInSeconds": 240 
                } 
            } 
        ], 
        "annotations": [], 
        "lastModifiedByObjectId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", 
        "lastPublishTime": "2024-02-01T17:28:02Z" 
    } 
}

ใช้วัตถุคุณสมบัติและล้อมรอบด้วยวงเล็บปีกกา - { } - ดังนั้นส่วนข้อมูลข้อกําหนดรายการ REST จะเป็น:

{
    "properties": { 
        "description": "this is the description", 
        "activities": [ 
            { 
                "name": "Wait1", 
                "type": "Wait", 
                "dependsOn": [], 
                "typeProperties": { 
                    "waitTimeInSeconds": 240 
                } 
            } 
        ], 
        "annotations": [], 
        "lastModifiedByObjectId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", 
        "lastPublishTime": "2024-02-01T17:28:02Z" 
    } 
} 

สร้างรายการ

REST API - รายการ - สร้างรายการ

ตัวอย่าง:

POST https://api.fabric.microsoft.com/v1/workspaces/<your WS Id>/items

เนื้อความ:

{ 
  "displayName": "pipeline_1", 
  "type": "DataPipeline" 
} 

หมายเหตุ

เอกสารระบุว่ามีคุณสมบัติที่จําเป็นเพียง 2 ประการได้แก่ displayName และ type ในปัจจุบัน Workload-DI ไม่รองรับการสร้างโดยไม่มี ข้อกําหนด เช่นกัน การแก้ไขสําหรับข้อกําหนดที่มีข้อผิดพลาดนี้ถูกปรับใช้อยู่ในขณะนี้ ในตอนนี้ คุณสามารถส่งข้อกําหนดเริ่มต้นเดียวกับที่ใช้โดยอินเทอร์เฟซผู้ใช้ Fabric: ‘{"properties":{"activities":[]}}’

JSON ที่ปรับเปลี่ยนรวมถึงข้อกําหนด:

{ 
  "displayName": "pipeline_1", 
  "type": "DataPipeline", 
  "definition": { 
    "parts": [ 
      { 
        "path": "pipeline-content.json", 
        "payload": "eyJwcm9wZXJ0aWVzIjp7ImFjdGl2aXRpZXMiOltdfX0=", 
        "payloadType": "InlineBase64" 
      } 
    ] 
  } 
} 

การตอบสนอง 201:

{ 
    "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", 
    "type": "DataPipeline", 
    "displayName": "Pipeline_1", 
    "description": "", 
    "workspaceId": "<Your WS Id>" 
} 

ลบรายการ

REST API - รายการ - ลบรายการ

ตัวอย่าง:

DELETE https://api.fabric.microsoft.com/v1/workspaces/<your WS Id>/items/<pipeline id>

คําตอบ 200: (ไม่มีเนื้อความ)

รับรายการ

REST API - รายการ - รับรายการ

ตัวอย่าง:

GET https://api.fabric.microsoft.com/v1/workspaces/<your WS Id>/items/<pipeline id>

คําตอบ 200:

{ 
    "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", 
    "type": "DataPipeline", 
    "displayName": "Pipeline_1", 
    "workspaceId": "<your WS Id>" 
} 

รับข้อกําหนดรายการ

REST API - รายการ - ข้อกําหนดรับรายการ

ตัวอย่าง:

POST https://api.fabric.microsoft.com/v1/workspaces/<your WS Id>/items/<pipeline id>/getDefinition

คําตอบ 200:

{ 
    "definition": { 
        "parts":[ 
            { 
                "path": "pipeline-content.json", 
                "payload": "ewogICJwcm9wZXJ0aWVzIjogewogICAgImFjdGl2aXRpZXMiOiBbXQogIH0KfQ==", 
                "payloadType": "InlineBase64" 
            } 
        ] 
    } 
} 

รายการในรายการ

REST API - รายการ - รายการ

ตัวอย่าง:

GET https://api.fabric.microsoft.com/v1/workspaces/<your WS Id>/items

คําตอบ 200:

{ 
    "value": [ 
        { 
            "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", 
            "type": "SemanticModel", 
            "displayName": "deata_lh", 
            "description": "", 
            "workspaceId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" 
        }, 
        { 
            "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", 
            "type": "SQLEndpoint", 
            "displayName": "deata_lh", 
            "description": "", 
            "workspaceId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" 
        }, 
        { 
            "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", 
            "type": "Lakehouse", 
            "displayName": "deata_lh", 
            "description": "", 
            "workspaceId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" 
        }, 
        { 
            "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", 
            "type": "DataPipeline", 
            "displayName": "Pipeline_1", 
            "description": "", 
            "workspaceId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" 
        } 
    ] 
} 

อัปเดตหน่วยข้อมูล

REST API - รายการ - รายการอัปเดต

ตัวอย่าง:

PATCH https://api.fabric.microsoft.com/v1/workspaces/<your WS Id>/items/<pipeline id>

เนื้อความ:

{ 
  "displayName": "Pipeline_1_updated", 
  "description": "This is the description." 
}

คําตอบ 200:

{ 
    "id": "<pipeline id>", 
    "type": "DataPipeline", 
    "displayName": "Pipeline_1_updated", 
    "description": "This is the description.", 
    "workspaceId": "<Your WS id>" 
}

อัปเดตข้อกําหนดรายการ

REST API - รายการ - อัปเดตข้อกําหนดรายการ

ตัวอย่าง:

POST https://api.fabric.microsoft.com/v1/workspaces/<your WS Id>/items/<pipeline id>/updateDefinition

เนื้อความ:

{ 
  "definition": { 
    "parts": [ 
      { 
        "path": "pipeline-content.json", 
        "payload": "eyJwcm9wZXJ0aWVzIjp7ImFjdGl2aXRpZXMiOltdfX0=", 
        "payloadType": "InlineBase64" 
      } 
    ] 
  } 
}

คําตอบ 200: (ไม่มีเนื้อความ)

รันงานสินค้าตามความต้องการ

REST API - รายการ - เรียกใช้งานรายการตามความต้องการ

ตัวอย่าง:

POST https://api.fabric.microsoft.com/v1/workspaces/<your WS Id>/items/<pipeline id>/jobs/instances?jobType=Pipeline

คําตอบ 202: (ไม่มีเนื้อความ)

ตัวอย่างที่มีค่าพารามิเตอร์สองค่า:

ที่นี่เรามี กิจกรรมการรอ ที่มีพารามิเตอร์ที่ ชื่อ param_waitsec เพื่อระบุจํานวนวินาทีที่จะรอ

POST https://api.fabric.microsoft.com/v1/workspaces/<your WS Id>/items/<pipeline id>/jobs/instances?jobType=Pipeline

เนื้อความ:

{ 
  "executionData": { 
    "parameters": {
      "param_waitsec": "10" 
    } 
  } 
}

คําตอบ 202: (ไม่มีเนื้อความ)

หมายเหตุ

ไม่มีเนื้อความส่งกลับในขณะนี้ แต่ควรส่งกลับรหัสงาน ในระหว่างการแสดงตัวอย่าง สามารถพบได้ในส่วนหัวที่ส่งกลับในคุณสมบัติ 'ตําแหน่งที่ตั้ง'

รับอินสแตนซ์งานของรายการ

REST API - รายการ - รับรายการอินสแตนซ์งาน

ตัวอย่าง:

GET https://api.fabric.microsoft.com/v1/workspaces/<your WS Id>/items/<pipeline id>/jobs/instances/<job ID>dotnetcli

คําตอบ 200:

{ 
    "id": "4511ffcd-a9f6-4f75-91a9-9ceab08d7539", 
    "itemId": "2bb9fe4a-0a84-4725-a01f-7ac4e6850259", 
    "jobType": "Pipeline", 
    "invokeType": "Manual", 
    "status": "Completed", 
    "failureReason": null, 
    "rootActivityId": "f14bdd95-2cff-4451-b839-bea81509126d", 
    "startTimeUtc": "2024-02-01T03:03:19.8361605", 
    "endTimeUtc": "2024-02-01T03:05:00.3433333" 
} 

ยกเลิกอินสแตนซ์งานของสินค้า

REST API - รายการ - ยกเลิกอินสแตนซ์งานของรายการ

ตัวอย่าง:

POST https://api.fabric.microsoft.com/v1/workspaces/<your WS Id>/items/<pipeline id>/jobs/instances/<job ID>/cancel

คําตอบ 202: (ไม่มีเนื้อความ)

หมายเหตุ

หลังจากยกเลิกงาน คุณสามารถตรวจสอบสถานะโดยการเรียกใช้ อินสแตนซ์ งานรับรายการ หรือดู ที่ประวัติ การเรียกใช้มุมมองในส่วนติดต่อผู้ใช้ Fabric

การเรียกใช้กิจกรรมคิวรี

ตัวอย่าง: POST https://api.fabric.microsoft.com/v1/workspaces/<your WS Id>/datapipelines/pipelineruns/<job id>/queryactivityruns

เนื้อความ:

{
  "filters":[],
  "orderBy":[{"orderBy":"ActivityRunStart","order":"DESC"}],
  "lastUpdatedAfter":"2024-05-22T14:02:04.1423888Z",
  "lastUpdatedBefore":"2024-05-24T13:21:27.738Z"
}

หมายเหตุ

"id งาน" เป็นรหัสเดียวกันที่สร้างขึ้นและใช้ใน API สาธารณะของผู้จัดกําหนดการงาน

คําตอบ 200:

[
    {
        "pipelineName": "ca91f97e-5bdd-4fe1-b39a-1f134f26a701",
        "pipelineRunId": "f2fa7a0e-586d-4d73-a2b4-7ddc785243ae",
        "activityName": "Wait1",
        "activityType": "Wait",
        "activityRunId": "ef579d3d-d23e-477a-8150-d6e15d66a532",
        "linkedServiceName": "",
        "status": "Succeeded",
        "activityRunStart": "2024-05-23T13:43:03.6397566Z",
        "activityRunEnd": "2024-05-23T13:43:31.3906179Z",
        "durationInMs": 27750,
        "input": {
            "waitTimeInSeconds": 27
        },
        "output": {},
        "error": {
            "errorCode": "",
            "message": "",
            "failureType": "",
            "target": "Wait1",
            "details": ""
        },
        "retryAttempt": null,
        "iterationHash": "",
        "userProperties": {},
        "recoveryStatus": "None",
        "integrationRuntimeNames": null,
        "executionDetails": null,
        "id": "/SUBSCRIPTIONS/4DA86268-68B8-4B08-AD58-A7AEE54138CD/RESOURCEGROUPS/4DA86268-68B8-4B08-AD58-A7AEE54138CD/PROVIDERS/MICROSOFT.TRIDENT/WORKSPACES/4DA86268-68B8-4B08-AD58-A7AEE54138CD/pipelineruns/f2fa7a0e-586d-4d73-a2b4-7ddc785243ae/activityruns/ef579d3d-d23e-477a-8150-d6e15d66a532"
    }
]

ข้อจำกัดที่ทราบ

  • การรับรองความถูกต้องของบริการหลัก (SPN) ไม่ได้รับการสนับสนุน