A Power Apps Custom Connector
Neil Haddley • June 27, 2021
Create a GitHub Repository
I created a GitHub Repository for the REST API code.

I created the repository

I published the repository

I opened the project in Visual Studio Code
Download example project code
I opened a Visual Studio Code terminal and ran dotnet new webapi to download example ASP.NET Core Web API code.

dotnet new webapi
Test the example project code
I created a dotnet project gitignore file and started the project.
BASH
1% dotnet new gitignore
BASH
1% dotnet run

dotnet new gitignore and dotnet run

I navigated to https://localhost:5001/WeatherForecast
Book class
The Book class includes id and title properties.
BookController class
The BookController class handles GET, POST, PUT, and DELETE actions.
Enable Swagger in production
I commented out the if (env.IsDevelopment()) condition to enable Swagger in production (Azure).

I commented out the "if (env.IsDevelopement())" code
Deploy the updated project code to Azure
I created a new web app.

haddley-power-app-api

.NET Core 3.1 runtime

I selected a pricing tier

I deployed the code to the new web app

I confirmed the deployment

I navigated to http://haddley-power-app-api.azurewebsites.net/swagger to see the GET, POST, PUT and DELETE actions
Use the Swagger user interface to test the API
In three steps:
Get the books
Add a book
Get the books (list should now include the *new* book)

I expanded the GET /Book action

I executed the GET /Book action

I reviewed the server response

I expanded the POST /Book action

I updated the request body

I executed the POST /Book action using the request body

I reviewed the server response

I executed the GET /Book action again

I reviewed the server response
API description
I clicked the "/swagger/v1/swagger.json" link to review a description of the API.

I exported the API description (OpenAPI version 3 format)

I uploaded the API description to API Transformer

I downloaded the API description (OpenAPI version 2 format)
New custom connector
I navigated to make.powerapps.com, selected the "Custom Connectors" menu item, and clicked the "+ New custom connector" button.

Custom Connectors

I selected the Import an OpenAPI file option

I imported the API description (OpenAPI version 2)

Books

I reviewed the General settings

I selected "No Authentication" (for now)

I tested the Book related actions

Books Custom Connector
swagger.json-Swagger20.json
JSON
1{ 2 "swagger": "2.0", 3 "info": { 4 "version": "v1", 5 "title": "haddley_power_app_api", 6 "contact": {} 7 }, 8 "host": "www.example.com", 9 "basePath": "/", 10 "schemes": [ 11 "https" 12 ], 13 "consumes": [ 14 "application/json" 15 ], 16 "produces": [ 17 "application/json" 18 ], 19 "paths": { 20 "/Book": { 21 "get": { 22 "description": "", 23 "summary": "Book_GET", 24 "tags": [ 25 "Book" 26 ], 27 "operationId": "Book_GET", 28 "deprecated": false, 29 "produces": [ 30 "text/plain", 31 "application/json", 32 "text/json" 33 ], 34 "parameters": [], 35 "responses": { 36 "200": { 37 "description": "Success", 38 "schema": { 39 "type": "array", 40 "items": { 41 "$ref": "#/definitions/Book" 42 } 43 }, 44 "headers": {} 45 } 46 } 47 }, 48 "post": { 49 "description": "", 50 "summary": "Book_POST", 51 "tags": [ 52 "Book" 53 ], 54 "operationId": "Book_POST", 55 "deprecated": false, 56 "produces": [ 57 "application/json" 58 ], 59 "consumes": [ 60 "application/json" 61 ], 62 "parameters": [ 63 { 64 "name": "body", 65 "in": "body", 66 "required": false, 67 "description": "", 68 "schema": { 69 "$ref": "#/definitions/Book" 70 } 71 } 72 ], 73 "responses": { 74 "200": { 75 "description": "Success", 76 "headers": {} 77 } 78 } 79 } 80 }, 81 "/Book/{id}": { 82 "get": { 83 "description": "", 84 "summary": "BookById_GET", 85 "tags": [ 86 "Book" 87 ], 88 "operationId": "BookById_GET", 89 "deprecated": false, 90 "produces": [ 91 "text/plain", 92 "application/json", 93 "text/json" 94 ], 95 "parameters": [ 96 { 97 "name": "id", 98 "in": "path", 99 "required": true, 100 "type": "integer", 101 "format": "int64", 102 "description": "" 103 } 104 ], 105 "responses": { 106 "200": { 107 "description": "Success", 108 "schema": { 109 "$ref": "#/definitions/Book" 110 }, 111 "headers": {} 112 } 113 } 114 }, 115 "put": { 116 "description": "", 117 "summary": "BookById_PUT", 118 "tags": [ 119 "Book" 120 ], 121 "operationId": "BookById_PUT", 122 "deprecated": false, 123 "produces": [ 124 "application/json" 125 ], 126 "consumes": [ 127 "application/json" 128 ], 129 "parameters": [ 130 { 131 "name": "id", 132 "in": "path", 133 "required": true, 134 "type": "integer", 135 "format": "int64", 136 "description": "" 137 }, 138 { 139 "name": "body", 140 "in": "body", 141 "required": false, 142 "description": "", 143 "schema": { 144 "$ref": "#/definitions/Book" 145 } 146 } 147 ], 148 "responses": { 149 "200": { 150 "description": "Success", 151 "headers": {} 152 } 153 } 154 }, 155 "delete": { 156 "description": "", 157 "summary": "BookById_DELETE", 158 "tags": [ 159 "Book" 160 ], 161 "operationId": "BookById_DELETE", 162 "deprecated": false, 163 "produces": [ 164 "application/json" 165 ], 166 "parameters": [ 167 { 168 "name": "id", 169 "in": "path", 170 "required": true, 171 "type": "integer", 172 "format": "int64", 173 "description": "" 174 } 175 ], 176 "responses": { 177 "200": { 178 "description": "Success", 179 "headers": {} 180 } 181 } 182 } 183 } 184 }, 185 "definitions": { 186 "Book": { 187 "title": "Book", 188 "type": "object", 189 "properties": { 190 "id": { 191 "type": "integer", 192 "format": "int64" 193 }, 194 "title": { 195 "type": "string" 196 } 197 } 198 } 199 }, 200 "tags": [ 201 { 202 "name": "Book", 203 "description": "" 204 } 205 ] 206}