cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ruud
Frequent Visitor

Using a form with a Rest API

I got my custom connector working with our Rest API and if I use the local collections (as an offline mode cache), I can work perfectly fine with the Rest API.

 

But what I can get to work is a form with data straight from the API. I have Gallery with users, you can select one user to edit the details of the user. So I want to show a form and the form needs to get the data from the Rest API.

 

For the DataSource I have the following :

CustomAPI.GetEmployee({id: ProjectEmployeeGallery.Selected.id})

But then it still requires something in the Item field.

 

So how do I use the data from the API straight in the form? Because I don't see any fields when I look at the properties of the form?

1 ACCEPTED SOLUTION

Accepted Solutions
yashag2255
Dual Super User II
Dual Super User II

Hey @Ruud 

 

You need to update the Response Sample JSON payload added in the Action definition of the custom connector. Once this is done, remove the custom connector connection from the app and add it again.
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

6 REPLIES 6
yashag2255
Dual Super User II
Dual Super User II

Hi @Ruud 

 

To return the result from a Custom connector, you need to trigger this by a button or some action. If you wish to directly load the results in a form, there is no direct way but with the use of collection, this can be achieved.
 
Configurations:
 
Gallery -> OnSelect -> ClearCollect(MyResponseCollection, CustomAPI.GetEmployee({id: ProjectEmployeeGallery.Selected.id}))
 
This will store the response in a collection and you can refer this collection into your edit forms.
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Ruud
Frequent Visitor

Ok, so it's the same way as I use it now with the Galleries. Only there was the goal to use the collection as an offline buffer, but this will work.

 

One other question, how do you update the structure of a collection? I added a field to the results from the API, but the structure of the collection in PowerApps doesn't seem to get updated.

The field is returned when I check the result from the API with Postman.

yashag2255
Dual Super User II
Dual Super User II

Hey @Ruud 

 

You need to update the Response Sample JSON payload added in the Action definition of the custom connector. Once this is done, remove the custom connector connection from the app and add it again.
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Ruud
Frequent Visitor

Ah yes, if forget that step indeed! Thanks!

yashag2255
Dual Super User II
Dual Super User II

Hey @Ruud 

 

Were you able to resolve? If so, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

v-xida-msft
Community Support
Community Support

Hi @Ruud ,

Have you solved your problem?

 

Firstly, if you want to connect a Edit form to a Collection, I afraid that there is no way to achieve your needs. Currently, the Edit form/Display form in PowerApps could only allowed to connected to a Table data source, e.g. Excel table, SQL Table, SP List, etc. It is not supported to connect to collection or action data source (e.g. Office 365 Users, Outlook, etc).

More details about data source types in PowerApps, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/connections-list

 

Even though, you set the collection as data source in your Edit form, the columns in your collection would not be rendered as Data cards automatically in your Edit form.

 

As an alternative solution, you could consider create a Edit table using Gallery to display records retrieved from your RES API, then you could edit your records within the Gallery. Please check the following blog or video for more details:

https://powerapps.microsoft.com/en-us/blog/editable-tables/

https://www.youtube.com/watch?v=O2WqhRTUhyw

 

If you added a field to the results from your REST API, you shoud re-configure your custom connector within your PowerApps. Please edit your customer connector action, then edit the Response part, then click "Import from sample", within the Response Body, you should include the new added filed, then click "Import" button and save your custom connnector. After that, try your custom connector action in your app, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,686)