Creating MS Power Apps connector to i2Rest Server

From i2Rest
Jump to: navigation, search

This scenario shows you an example how to create Power Apps custom connector to i2Rest Server.
It assumes that you have completed the case Configuring OAuth2 authorization and secured main gate with https

1. Open Power Apps Custom connector page:
Power Apps - Mozilla Firefox 12.07.2020 18 22 17.png

2. Press "New custom connector":
Power Apps - Mozilla Firefox 12.07.2020 18 24 19.png

3. Select "Import an OpenAPI from URL":
Power Apps - Mozilla Firefox 13.07.2020 8 35 41.png

4. Enter Connector name and URL for the Open API (<your_i2Rest_server>/swagger20/<mount_point>), press Import:
Power Apps - Mozilla Firefox 13.07.2020 8 35 45.png

5. Press Continue:
Power Apps - Mozilla Firefox 12.07.2020 18 34 01.png

6. Press "Security->". Enter fields Client Id, Client secret. Copy value of Token URL and paste it to Refresh URL:
Power Apps - Mozilla Firefox 13.07.2020 8 33 07.png

7. Press Definition->:
Power Apps - Mozilla Firefox 12.07.2020 18 44 58.png

8. Press "Create connector" on top of screen, then click on "2. Security" tab:
Power Apps - Mozilla Firefox 12.07.2020 18 45 44.png

9. Copy value of field "Redirect URL" and paste it into the redirect_uri parameter in your i2Rest Server configuration file:

        "TSTCLNT":{"redirect_uri":"https://global.consent.azure-apim.net/redirect", 
                  "description":"Test client", 
                  "valid_scopes":["run_program"],
                  "valid_grant_types":["authorization_code"]}

10. Restart i2Rest Server to apply changed redirect_uri

11. Open "4. Test" tab
: Power Apps - Mozilla Firefox 12.07.2020 18 46 19.png

12. Press "New connection":
Power Apps - Mozilla Firefox 12.07.2020 18 46 41.png

13. Press "Create". It will start OAuth2 authorization code flow and open Login page:
Login V14 - Mozilla Firefox 12.07.2020 19 41 20.png

14. Enter IBM i user ID (i2Rest Server configuration file) and password and press Login:
Login V14 - Mozilla Firefox 12.07.2020 18 48 05.png

15. Press "Allowed" to allow client TSTCLNT to run programs on IBM i under authority of USRX. New connection will be created:
Power Apps - Mozilla Firefox 12.07.2020 18 48 32.png

16. Go back to "Custom Connectors" tab:
Power Apps - Mozilla Firefox 12.07.2020 18 48 59.png

17. Press "Edit" (pencil icon) and go to "4. Test" tab, you'll see newly created connection in "Selected connection" field:
Power Apps - Mozilla Firefox 12.07.2020 18 49 31.png

18. Enter operation parameters:
Power Apps - Mozilla Firefox 12.07.2020 18 50 04.png

19. Press "Test operation" to call API using OAuth2 token:
Power Apps - Mozilla Firefox 12.07.2020 18 50 30.png

You'll see the response from i2Rest Server:
Power Apps - Mozilla Firefox 12.07.2020 18 50 30.png

Press "Test operation" again - server will respond with incremented output.echo value, job will be the same:
Power Apps - Mozilla Firefox 12.07.2020 18 50 54.png

We just finished creating a new MS Power Apps Custom connector to i2Rest Server.