cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jl_144432
Regular Visitor

Pass parameters to custom API

Dear community,

 

I am new to powerapps and want to ask if I could achieve the following functionality:

- let user input some data and after that, send those data as parameters to my custom API with a POST, so that my backend can receive those data as string as manipulate them.

 

I know that with text input I can save the string as a variable, but I don't know whether is possible to send it to my API endpoint.

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @jl_144432 ,

 

Custom connector can meet your needs.

v-xiaochen-msft_0-1615877033802.png

 

After the custom connector is created, create a connection.

Add the connection to the canvas app, and finally use the formula of the custom connector and enter the parameters.

v-xiaochen-msft_1-1615877264558.png

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

 

 

View solution in original post

7 REPLIES 7
v-xiaochen-msft
Community Support
Community Support

Hi @jl_144432 ,

 

Custom connector can meet your needs.

v-xiaochen-msft_0-1615877033802.png

 

After the custom connector is created, create a connection.

Add the connection to the canvas app, and finally use the formula of the custom connector and enter the parameters.

v-xiaochen-msft_1-1615877264558.png

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

 

 

Thanks for the reply, that also works with a table template right? And where could I replace the string by my variables?

v-xiaochen-msft
Community Support
Community Support

Hi @jl_144432 ,

 

Do you mean you want to pass a table parameter instead of a string(text) parameter?

 

If my understanding is correct, you could use the table() function:

Table({Column1:"A",Column2:"B"},{Column1:"C",Column2:"D"})

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

nono sorry was saying tablet. I mean where should I put the input parameters as variables? Imagine that I have an api endpoint that connects to api function getweather(string city) and returns me the weather(a string), where should I put the city input?

v-xiaochen-msft
Community Support
Community Support

Hi @jl_144432 ,

 

I may understand what you mean.

So, according to your description, you are using a get api instead of a post api.

You only need to enter the correct URL with query, and the custom connector will automatically recognize the input (string city).

v-xiaochen-msft_0-1615947608086.png

v-xiaochen-msft_1-1615947642394.png

 

Hope this link will help you.(This is a weather Api. When you enter a city, it will return the weather of that city)Here

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

 

 

Thanks!

This does work... in my swagger I defined the parameters that are acceptable and then in my button.onSelect  I called my API and passed in the parameters.  I was distracted with having to creating a JSON for the body, but it looks like power apps does that for you behind the scene.  My solution looked something like this:

 

testAPI.updateQuestion({id:"123", Description:"aa", CreatedBy:"c", QuestionNumber:"1", QuestionText:["a1","a2"], Education:{Title:"t",URL:"tu", Type:"t"}})

 

now all I need to do is replace the values with the actual form values such as:   TI_Description.Text

 

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,774)