How to store results of API query to PowerApps collection

136 Views Asked by At

I'm new to PowerApps, but found some sample code that looked promising when trying to figure out how to store the results of an API query to a collection. The problem is, my collection has 3 fields to match what I receive back in my API query but the data is being stored in a collection field called "Value" (which I don't explicitly create). I can't figure out the syntax to store the returned data to correct fields.

Here's my query:

ClearCollect(ApiKeyCollection, ACMECorp.Authorize({api_key:"MyAPIKey", client_db:"MyTestDB", username:"MyUserName"})**.access_token**)

I've tried adding the other collection fields in the ClearCollect, but get syntax errors if I use anything other than one of these fields.

Can someone advise how to store the returned data to individual collection fields?

1

There are 1 best solutions below

0
On

I figured it out. After looking at some similar examples, I realized you just need to ensure your response body from custom connector fields align with exactly what you've defined in your collection and then simply need to omit trying to map a specific field in the response body to the collection. My code now works as follows:

ClearCollect(ApiKeyCollection, ACMECorp.Authorize("MyAPIKey", "MyTestDB", "MyUserName"))