RobD
RobD

Reputation: 455

Connect powerapps to 3rd party RESRT

Trying to connect powerapps to 3rd party REST service, this service requires an authentication token. I can do this easy enough with requests and python, but someone wants to do it in powerapps.

I need to pass this token from powerapps to the REST service something like this:

Python

headers = {"content-type": "application/json", "Authorization": "Xy454uu99blahblah"}
result_get = requests.get(url, headers=headers)

anyway to do this? I don't know a whole lot about powerapps?

Python

headers = {"content-type": "application/json", "Authorization": "Xy454uu99blahblah"}
result_get = requests.get(url, headers=headers)

Upvotes: 1

Views: 1690

Answers (3)

SeaDude
SeaDude

Reputation: 4365

Here's how I've done this type of token auth in the past using a Custom Connector and Flow:

  1. Create a Custom Connector to your REST endpoint (NOT token server)
  2. Create a new Flow (named finalDataCall) with PowerApps as trigger
  3. Create an HTTP Action to call the token server using a GET method
  4. Add a parse JSON action to get the token alone
  5. In Flow, add your Custom Connector as an Action.
    • For all parameters except the token, choose "Ask in PowerApps".
    • Use the token parsed from the JSON above to pass in the token parameter
  6. Add a Response Action in Flow to shape the response
  7. For the OnSelect property in PowerApps (assuming user pushes a button) use:
ClearCollect(
    colFinalDataCall,
    finalDataCall.Run(
        queryParam1.Text,
        queryParam2.Text,
        queryParam3.Text,
        queryParam4.Text)
)

This will collect the response from the Flow call into PowerApps so you can manipulate the data.

Not for the faint of heart, but its been operating soundly for me for over a year now.

Here is the original forum post with pictures.

Upvotes: 0

carlosfigueira
carlosfigueira

Reputation: 87228

In addition to using Flow as suggested by @ChrisMoncayo, you can also use a custom connector that can be called directly from PowerApps. The linked resource has more information about creating a custom connector for your API (or feel free to post new questions if you have problems when creating one).

Upvotes: 0

ChrisMoncayo
ChrisMoncayo

Reputation: 36

You can't call 3rd party rest directly from PowerApps. You will need to use a Flow to return the data.

Here is a similar answered question Rest API calls with PowerApps

Hope this helps.

Upvotes: 2

Related Questions