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

Create Repository

Publish Repository

open in Visual Studio Code
Download example project code
Open a Visual Studio Code terminal and use the command:
BASH
1% dotnet new api
to download example ASP.NET Core Web API code.

dotnet new webapi
Test the example project code
Create a dotnet project gitignore file:
BASH
1% dotnet new gitignore
Start the project:
BASH
1% dotnet run

dotnet new gitignore and dotnet run

navigate to https://localhost:5001/WeatherForecast
Book class
The Book class include id and title properties
BookController class
The BookController class is able to handle GET, POST, PUT and DELETE actions
Enable Swagger in production
Comment out the if (env.IsDevelopment()) condition to enable Swagger in production (Azure)

comment out the "if (env.IsDevelopement())" code
Deploy the updated project code to Azure
Create new web app.

haddley-power-app-api

.NET Core 3.1 runtime

Select pricing tier

Deploy the code to the new web app

confirm deployment of the code

navigate to http://haddley-power-app-api.azurewebsites.net/swagger to see a list of 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)

Expand the GET /Book action

execute the GET /Book action

Review the server response

Expand the POST /Book action

Update the request body

Execute the POST /Book action using the Request body

Review the Server response

Execute the GET /Book action

Review the Server response
API description
Click the "/swagger/v1/swagger.json" link to review a description of the API.

Export/Save the API description (openapi version 3 format)

Upload the API description to API Transformer

Download the API description (openapi version 2 format)
New custom connector
Navigate to make.powerapps.com and select the "Custom Connectors" menu item.
Click the "+ New custom connector" button.

Custom Connectors

Select the Import an OpenAPI file option

Import the API description (openapi version 2)

Books

Review the General settings

Select "No Authentication" (for now)

Test 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}