How to build a connector from an OpenAPI Spec file and consume it in a Power App
Published Sep 20 2022 11:10 PM 1,323 Views
Microsoft

Day 5 of the 30DaysofFusion Program Summary

Today, we have covered building the SWAPI connector (The Star Wars API) from scratch with an introduction to Triggers and Policies, consuming it directly from a Power App and learnt how to build a custom connector from an OpenAPI specification file.

Day 3 covered a detailed introduction to connectors and how to build a custom connector from scratch...

Suppose you want to build your first connector, what are your options?

  1. [Recommended] We have hundreds of existing services/ APIs that are inaccessible from the power platform today. You may decide to look through the list of existing connectors, identify a service with a Public API that is missing a connector and decide to build it for this hackathon. For inspiration on which connector you can build, see a list of the Top Connector Asks Today

    Steps

    A) Identify the Public API, describing available endpoints (/users), operations (GET/users) and operation parameters inputs & outputs

    B) Obtain the OpenAPI spec file or Postman collection. APIs like the Daraja API have the Postman collections ready for you. 

    Julia_Muiruri_0-1663656642348.png

     

    C) Use it to create a connector

Create your own API, publish it, then create a connector for it.

Steps

A) Write your own API

b) Generate an OpenAPI Spec file. (The connector creation wizard currently supports only v2.0 spec files)

  • If you are working in python, you can use the FastAPI framework which will document the API for you

If JavaScript, you can use Nestjs Framework for your API definition 

Julia_Muiruri_1-1663656668447.png

 

What next after creating a connector?

Julia_Muiruri_2-1663656684472.png

 

Actions, Triggers & Policy Templates

An Action is what your connector can do. For example, the SWAPI Connector that we created today has an action called 'GetPeople' that returns Star Wars characters and properties like height, mass, hair color etc. from the API

 

A Trigger is an event/ a condition that when met, causes the system to do something or respond to changes in the underlying data/service. For example, using the Outlook.com connector, you can define steps to be takes automatically when a new email arrives in your inbox, and in this case, when a new email arrives is a trigger for the outlook.com connector

There are 2 Types of Triggers: 

Julia_Muiruri_3-1663656684819.png

 

A Policy is added while creating a connector to modify its behavior at runtime. For example, if the API you are working with has a limited number of API calls, you can set throttling limits using a Policy 

 

Julia_Muiruri_4-1663656684663.png

 

Next Steps

Head over to https://make.powerautomate.com/ and start today!

Explore resources shared on the presentation deck

Build your first connector, share on social media and tag us to celebrate your learning!

 

Co-Authors
Version history
Last update:
‎Sep 20 2022 12:07 AM
Updated by: