Extending the swagger file for the Approval custom connector

Posted by

In the official Power Apps blog post ‘Building an Approval experience in Canvas Apps‘ (published on April 15, 2020) there’s a link to the swagger file for the Approval custom connector that exposes the operations to retrieve sent and received approvals, and to approve or reject an approval request. From the Approvals action center in Power Automate it’s also possible to cancel an approval (as owner) and to reassign approval requests. So I’ve decided to extend the swagger file with these additional operations. The cancel operation is now part of the extended swagger file.

Get the extended swagger file for the Approval custom connector here: https://2die4it.com/swaggerapprovalextended

Edit the values for the host and default name for your environment:

"host": "emea.api.flow.microsoft.com",
          {
            "name": "environment_name",
            "in": "path",
            "required": true,
            "type": "string",
            "default": "72e87f56-e215-43d4-8883-5cf7ff5550f5"
          },

Follow the instruction of the original blog post for the custom connector deployment. Once the custom connector is created based on the swagger file, the Cancel Approval action can be added to your flow.

Here’s just a simple test to show that it works.

The cancel action is added as activity to the approval history in the Approvals action center of Power Automate.

Next step is to add the reassign operation to the extended swagger file. To be continued.

6 comments

  1. Please, we try to call GET /approvalViews from our SPFX application to visualize who the document approval is pending on.
    But we are facing an issue now to setup proper Authorization. All attempts ends:
    {
    “error”: {
    “code”: “InvalidAuthenticationTokenAudience”,
    “message”: “The access token has been obtained from wrong audience or resource ‘00000002-0000-0000-c000-000000000000’. It should exactly match (including forward slash) with one of the allowed audiences ‘https://service.flow.microsoft.com/’,’https://management.core.windows.net/’,’https://management.azure.com/’,’https://service.powerapps.com/’,’https://service.kratosapps.com/’,’637fcc9f-4a9b-4aaa-8713-a2a3cfda1505′.”
    }
    }

    Thanks for any help.

  2. Hi StefanS365,

    I’ve implemented a custom connector in “Power Automate” using your swagger file. When I’m testing the Connector in the Connectors Test Area it works, but when I’m using it in a flow I get an error that the caller hasn’t the permission to use the connector:

    “The caller with object id ‘d513ca44-e3a8-491d-9ba0-29e4ddabed3b’ does not have permission for connection ‘/providers/Microsoft.PowerApps/apis/shared_approvals-20extended-5f8f83aaa5204d6ef5-5f5784f00b150c8796/connections/a07bbe6a-bcbc-4a7d-bf88-eb08-4e045b52’ under Api ‘shared_approvals-20extended-5f8f83aaa5204d6ef5-5f5784f00b150c8796’.”

    Do you know this issue or have you any idea how to fix it?

    Regards,
    Ingrid

  3. Hi StefanS365,
    it seems that the error I’ve previously posted is solved.
    The Flow that I’ve been tested has another connection, that causes that error. When I’m testing it with another flow, it works.
    Regards,
    Ingrid

Leave a Reply

Your email address will not be published. Required fields are marked *