I have a CustomConnector that connects to Microsoft Graph REST API to get the groups in an organization. This endpoint URL and query parameters such as orderby, filter, skiptoken, top are currently hardcoded but I would like to make it generic so that I can reuse by passing arguments to the connector from the PowerApps.

Solution

To create a custom connector, you must describe the API you want to connect to so that the connector understands the API’s operations and data structures. The custom connector wizard gives you a lot of options for defining how your connector functions, and how it is exposed in apps.

On the Definition page, The Request area displays information based on the HTTP request for the action. Choose Import from sample and configure sample as shown below:

screen-shot-2019-09-12-at-6.04.52-pm

screen-shot-2019-09-12-at-6.05.53-pm

At the top right of the wizard, choose Update connector. Now that we have configured the connector, test it to make sure it’s working properly.

On the Test page, create connection and return to the Test page:

Now, enter the values for the text fields, then choose Test operation.

screen-shot-2019-09-12-at-6.06.41-pm

The connector calls the API, and you can review the response.

Return to your PowerApps app and configure your expression as show below:

That is all. The Group Collection should have the REST API response data.

screen-shot-2019-09-12-at-6.07.30-pm

Important Note: Some requests return multiple pages of data so do not pass the $skiptoken for the first call. The $skiptoken parameter contains an opaque token that references the next page of results and is returned in the URL provided in the @odata.nextLink property in the response.