cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Carsten
Level: Powered On

Azure Functions V2 and PowerApps - how to do swagger manually? Or other ideas?

i am starting with PowerApps and i love it! I was about to have some room availability app and have seen the "book a room" PowerApp demo. Then i was a bit disappointed that no room details function was available out of the box (oh no! - i was so close to my goal 🙂 , but found an advice how to do this in Visual Studio using Azure Functions.


Now i learned how to do Azure Functions in VS, publish to Azure, do all the Azure Account license stuff, uploaded the function and yeah - it works in the browser test, queries Exchange as it should, also when uploaded! Now trying to use OpenAPI and create this decoration / swagger thing, so that it can talk to PowerApps. But then - bummer: No support for V2 functions ( i was not even aware that there is V1.1 and V2) and no button to find to switch back to V1.1.. (oh no! - i was so close to my goal 🙂


So please - tell me how to climb over this obstacle too - like how can i easyest create this swagger / decoration / openAPI - JUST to see my room booking details.. 🙂


Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Carsten
Level: Powered On

Re: Azure Functions V2 and PowerApps - how to do swagger manually? Or other ideas?

 Hi Mona,

 

in the meantime i succeeded with V2 and some heavy workarounds (I think V1 does not contain some of the functions i want to use). Maybe it helps somebody else:

 

1) I found a sample YAML file very close to what i needed here: http://www.richardmcgrath.io/2017/06/create-exchange-meeting-rooms-api-with_21.html

2) Did adjustments by try and error (steps 1 to 4) guessing what to do and how to format

3) i converted it to json by a public YAML to JSON (Swagger) converter on the internet, extracting my code before doing so and putting it in again later in the result by search&replace

4) in powerapps, create the connector by using the "load from file" option.

 

Connector "lives" and works fine now.

 

View solution in original post

4 REPLIES 4
Community Support Team
Community Support Team

Re: Azure Functions V2 and PowerApps - how to do swagger manually? Or other ideas?

Hi @Carsten ,

 

The OpenAPI feature is only available for v1 functions as of today.

You can refer to this doc on how to change the runtime version of a function app to v1.

Please be aware that this change will only be possible in an empty function app and would require you to manually migrate any existing functions.

 

You could also create a feature request in UserVoice.

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Carsten
Level: Powered On

Re: Azure Functions V2 and PowerApps - how to do swagger manually? Or other ideas?

 Hi Mona,

 

in the meantime i succeeded with V2 and some heavy workarounds (I think V1 does not contain some of the functions i want to use). Maybe it helps somebody else:

 

1) I found a sample YAML file very close to what i needed here: http://www.richardmcgrath.io/2017/06/create-exchange-meeting-rooms-api-with_21.html

2) Did adjustments by try and error (steps 1 to 4) guessing what to do and how to format

3) i converted it to json by a public YAML to JSON (Swagger) converter on the internet, extracting my code before doing so and putting it in again later in the result by search&replace

4) in powerapps, create the connector by using the "load from file" option.

 

Connector "lives" and works fine now.

 

View solution in original post

DeeTronSEAM
Level: Powered On

Re: Azure Functions V2 and PowerApps - how to do swagger manually? Or other ideas?

@Carsten ,

 

Any chance you can share your JSON / Swagger file?  Or maybe the original YAML you started with, please?  The former would be ideal.  Mr. McGrath's site doesn't seem to be available anymore. 😞

 

Since I'm pretty much trying to do the same thing you did, any other help/files you can provide would also be greatly appreciated.  Thanks!

Carsten
Level: Powered On

Re: Azure Functions V2 and PowerApps - how to do swagger manually? Or other ideas?

welcome, here you are

 

This is of course without auth or code and not my real URL

 

I suggest you start with a "proof of life" function that gives you back just a string, and build a connector from it to have all the tool chain touched, then extend with arguments, code, auth etc.

 

Sorry, i cannot attach the files - so you have to put the following texts into files yourself:

 

yaml:

 

swagger: '2.0'
info:
  title: https://myroomhelper.azurewebsites.net
  version: 1.0.0
host: https://myroomhelper.azurewebsites.net
basePath: /
schemes:
  - https
  - http
paths:
  '/api/GetRoomDetails/{roomname}/{year}/{month}/{day}':
    get:
      summary: 'Appointments for a given room on a given year, month and day'
      operationId: GetRoomDetails
      produces: []
      consumes: []
      parameters:
        - name: roomname
          in: path
          required: true
          type: string
        - name: year
          in: path
          required: true
          type: string
        - name: month
          in: path
          required: true
          type: string
        - name: day
          in: path
          required: true
          type: string
        - name: code
          in: query
          default: keygoeshere
          type: string
      description: 'Appointments for a given room on a given year, month and day'
      responses:
        '200':
          description: Success operation
          schema:
            type: array
            items:
              type: object
              properties:
                Subject:
                  type: string
                Start:
                  type: string
                  format: date-time
                End:
                  type: string
                  format: date-time
                Organiser:
                  type: string
                OrganiserEmail:
                  type: string
  /api/ProofOfLife:
    get:
      operationId: ProofOfLife
      summary: Get i am running result for debuggin
      produces: []
      consumes: []
      description: ProofOfLife
      responses:
        '200':
          description: Success operation
          schema:
            type: string
  /api/GetRoomLists:
    get:
      operationId: GetRoomLists
      summary: Get room lists
      produces: []
      consumes: []
      parameters:
        - name: code
          in: query
          default: keygoeshere
          type: string
      description: Room Lists
      responses:
        '200':
          description: Success operation
          schema:
            type: array
            items:
              type: object
              properties:
                Name:
                  type: string
                Address:
                  type: string
                RoutingType:
                  type: string
                MailboxType:
                  type: integer
                Id:
                  type: integer
  '/api/Rooms/{name}/List':
    get:
      operationId: GetRooms
      summary: Rooms for a given room list
      produces: []
      consumes: []
      parameters:
        - name: name
          in: path
          required: true
          type: string
        - name: code
          in: query
          default: keygoeshere
          type: string
      description: Rooms for a given room list
      responses:
        '200':
          description: Success operation
          schema:
            type: array
            items:
              type: object
              properties:
                Name:
                  type: string
                Address:
                  type: string
                RoutingType:
                  type: string
                MailboxType:
                  type: integer
                Id:
                  type: integer
definitions: {}

json:

 

{
  "swagger": "2.0",
  "info": {
    "title": "MyRoomHelper",
    "version": "1.0.0"
  },
  "host": "MyRoomHelper",
  "basePath": "/",
  "schemes": [
    "https",
    "http"
  ],
  "paths": {
    "/api/GetRoomDetails/{roomname}/{year}/{month}/{day}": {
      "get": {
        "summary": "Appointments for a given room on a given year, month and day",
        "operationId": "GetRoomDetails",
        "produces": [],
        "consumes": [],
        "parameters": [
          {
            "name": "roomname",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "year",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "month",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "day",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "description": "Appointments for a given room on a given year, month and day",
        "responses": {
          "200": {
            "description": "Success operation",
            "schema": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "Subject": {
                    "type": "string"
                  },
                  "Start": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "End": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "Organiser": {
                    "type": "string"
                  },
                  "OrganiserEmail": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/ProofOfLife": {
      "get": {
        "operationId": "ProofOfLife",
        "summary": "Get i am running result for debuggin",
        "produces": [],
        "consumes": [],
        "description": "ProofOfLife",
        "responses": {
          "200": {
            "description": "Success operation",
            "schema": {
              "type": "string"
            }
          }
        }
      }
    },
    "/api/GetRoomLists": {
      "get": {
        "operationId": "GetRoomLists",
        "summary": "Get room lists",
        "produces": [],
        "consumes": [],
        "description": "Room Lists",
        "responses": {
          "200": {
            "description": "Success operation",
            "schema": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "Name": {
                    "type": "string"
                  },
                  "Address": {
                    "type": "string"
                  },
                  "RoutingType": {
                    "type": "string"
                  },
                  "MailboxType": {
                    "type": "integer"
                  },
                  "Id": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/Rooms/{name}/List": {
      "get": {
        "operationId": "GetRooms",
        "summary": "Rooms for a given room list",
        "produces": [],
        "consumes": [],
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "description": "Rooms for a given room list",
        "responses": {
          "200": {
            "description": "Success operation",
            "schema": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "Name": {
                    "type": "string"
                  },
                  "Address": {
                    "type": "string"
                  },
                  "RoutingType": {
                    "type": "string"
                  },
                  "MailboxType": {
                    "type": "integer"
                  },
                  "Id": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "definitions": {}
}

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 105 members 5,424 guests
Please welcome our newest community members: