Microsoft Fabric

Microsoft Fabric

Step 1: Create a Workspace

  1. Open Microsoft Fabric.
  2. Select Workspaces.
  3. Click New Workspace.
  4. Enter the workspace name.
  5. Select de WorkSpace Type and Apply.

Step 2: Create the Web v2 Connection

  1. Navigate to Settings > Manage Connections and Gateways.
  2. Click "+ New".
  3. Select Cloud.
  4. Enter a connection name.
  5. Select the connection type : Web v2.
  6. Enter the API base URL: https://api.teamspowerpack.com.
  7. Enter the Token Audience URI: api://11219288-2ee1-4f2d-b6f8-75d817c38d05
  8. Select Authentication method: OAuth 2.0
  9. Click Edit Credentials.
  10. When prompted, sign in using an organizational account.
  11. When prompted, sign in using an organizational account.
  12. Complete the Microsoft authentication flow.
  13. After authentication succeeds, return to the connection settings page and configure the privacy level: Organizational.
  14. Click Create.
  15. Verify that the connection is successfully created and appears in the Manage Connections and Gateways list with a healthy status.




Step 3: Create and Configure the Pipeline 

3.1 Create a New Data Pipeline

  1. Navigate to the previously created workspace.
  2. Click "+ New Item".
  3. Select Data Pipeline.
  4. Enter a name.
  5. Click Create.

3.2 Create the Pipeline Variables

  1. Open the Pipeline.
  2. Select the Variables tab.
  3. Click "+ New".
  4. Create the next variables:
    1. Variable Name: nextPageUrl
    2. Type: String

3.3 Add the initial API request activity

  1. Drag a Web activity onto the pipeline canvas.

  2. Rename the activity.
  3. Open the Settings tab.
  4. Select the connection created previously.
  5. Add a relative URL.
  6. Select the "GET" Method.

3.4 Validate the initial request.

  1. Save the changes and select Run.
  2. Wait for the activity to complete.
  3. Open the activity output.
  4. Verify that records are returned by the API.
  5. Verify that a nextpagelink property is included when additional pages are available.
  6. Confirm the activity completes successfully before continuing.



3.5 Store the Next Page URL.

  1. Drag a Set Variable activity onto the canvas.
  2. Connect it to execute after "GetInitialRecords" completes successfully. 
  3. Rename the activity: StoreNextPageUrl
  4. Configure the variable to update the value of nextPageUrl.
     
  5. Set the value using the following expression:
Quote
@replace(activity('GetInitialRecords').output.nextpagelink,'https://api.teamspowerpack.com:443','')

3.6 Add the Pagination Loop

  1. Drag an Until activity onto the pipeline canvas.
  2. Connect the "StoreNextPageUrl" activity to the Until activity.
  3. Rename the activity: ProcessRemainingPages
  4. Open the Until activity settings.
  5. Configure the loop exit condition
    Quote@empty(variables('nextPageUrl'))
  6. Leave the timeout with the default value or adjust it according to the expected execution time.


3.7 Add the Web Activity Inside the Loop

  1. Open the ProcessRemainingPages activity.
  2. Drag a Web activity inside the loop.
  3. Rename the activity: GetNextPage
  4. Open the Settings tab.
  5. Select the existing API connection.
  6. Configure the request method: GET
  7. Configure the Relative URL:
  8. Quote
    @variables('nextPageUrl')



3.8 Add the Activity to Update the Next Page URL

  1. Drag a Set Variable activity inside the loop.
  2. Connect it to execute after GetNextPage succeeds.
  3. Rename the activity: UpdateNextPageUrl
  4. Configure the variable to update: nextPageUrl
  5. Set the value using the following expression:
    Quote
    @if( contains(activity('GetNextPage').output, 'nextpagelink'),
    replace( activity('GetNextPage').output.nextpagelink, 'https://api.teamspowerpack.com:443', ''), '')

 3.9 Add the Wait Activity for HTTP 429 Responses 

  1. Inside the "ProcessRemainingPages" Until activity, drag a Wait activity onto the canvas. 
  2. Connect the Failed path from "GetNextPage" to the Wait activit
  3. Rename the activity: Wait429
  4. Open the activity settings.
  5. Configure the wait duration using the value returned by the API: 
Quote
 @int(activity('GetNextPage').output.retryAfterSeconds) 



3.10 Configure the Retry Request 

  1. Drag a new Web activity onto the canvas.  
  2. Connect the Completion path from "Wait429" to the new Web activity.  
  3. Rename the activity: WebRetry 
  4. Open the Settings tab. 
  5. Select the existing API connection. 
  6. Configure the request method: GET 
  7. Configure the Relative URL:
Quote @variables('nextPageUrl') 



3.11 Update the Next Page URL After the Retry 

  1. Add a Set Variable activity after "WebRetry". 
  2. Connect it to run when "WebRetry" succeeds. 
  3. Rename the activity: UpdateNextPageUrlAfterRetry 
  4. Configure the variable. 
  5. Variable Name: nextPageUrl 
  6. Set the value using the following expression: 
  1. Quote
@if( 

    contains(string(activity('WebRetry').output),'nextpagelink'), 

    replace( 

        activity('WebRetry').output.nextpagelink, 

        'https://api.teamspowerpack.com:443', 

        '' 

    ), ''