PowerApps - Call custom APIs with custom connector instantly

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone welcome back to the channel in today's video we are going to learn how we can directly create custom connectors and leverage or call that endpoint from poweramps so I have done only the couple of videos how you can create custom connectors one year back so I have just opened that video as well I'll put a link into the description so where like I explained the steps to create custom connector and call those custom connector endpoint or action using power domate or a flow but this time we are going to do that directly from powerapps so that rather than waiting for even for one second the result of the response should be immediate so we may require to call uh the fvp is it could be external or internal within your company's environment directly from powerapps so that is the way of doing it so rather than like having a intermediary flow or power automate in between you can directly call your custom connector have that endpoint hit and get the uh whatever response or result you want to have and show under the control so that's the thing which we are going to take a look today so I have opened my mail.powerapps.com and I'll start creating by creating one custom connector though like I have already explained that in one of one of the video but that for people who are already who are watching this for the first time so I'll just quickly create those steps and as well as discuss in the response we would require to have some adjustments to read the results so that's that's the way like there's a reason like I'll just create or recreate the entire custom connector once again and we'll show you so for example I'll be taking uh the example of calling a weather API which actually in turn takes the city name as parameter and returns me the response into the value into the Json which is having the location details the country and the current the temperatures with temperature underscore C and F this is what we are interested into so this we are going to get in the response back and the initial API call would be to this endpoint that is EPA dot weather api.com current version Json key and this key would be my this free key which I have registered for this site so this is an example this API endpoint could be anything for you it could be an internal uh an STP call or any external call let's start by creating any custom connector so I'll just go to the more and discover all where I should be able to find my data options and under data options we have this custom connectors so over here uh all the custom connectors into my environment would be listed so I can start by creating a new custom connector so I'll just say create from a blank and I just say that interactive weather API connector and now I'll start creating the general screen you can very well change the logo for your connector but I'm just leaving that as is and into the host we have to copy the host so I'll just copy this from is called and into the security I would just go to the security and the next step so authentication would be the key based API key based authentication parameter I'll just say key and key and in the next the diameter location would be is query because we are going to pass that into query and in next step we are going to go to the definition where we will start by creating one new action so that action would be get whether data and into this field just paste that into the operation ID as well and in that request we'll start importing from a sample and Sample which I just showcase you this API endpoint and the response header would be this so we'll just do that I'll just same import from sample and I'll place the end point and from this endpoint I'll just remove key because key would be part of all the the query where we have already described that in the security part of this custom connector so now this Q or the parameter this Q would be the city name so this would be just a city name so and we are going to give a get request and over here into the parameters will be seeing that it's taking the parameter for that q q parameters city name and over here in the response we have to is use uh the default response like what response it would be giving back to power apps like when it calls that connector or power automate so uh if you are using directly within this connector in the power domain you may just interpret that entire full responsation of the body into the power domate and then use the compose action to extract or pass this in action to extract the uh the actual data out of it but as you are going to use that into power apps so we have to properly Define the responses that what exactly we want to read so I'll just say add default response and over here I'll just go back to my Explorer and I'll into the response header I will just copy the entire response header and go to custom connector back into the Json this is the body Json what you are expecting uh as a response of this call so over here if I just go back to my into the weather API Explorer and this is like the sample response body would be like this so this is having that all that attributes but we are just focused on this temperature cells is part of it so I'll just though like I'll just copy but I'll just uh remove whatever I don't want so I'll just keep on removing or update my Json I'll just remove this and into this condition as well I'll just keep this Fahrenheit temperature and the Celsius temperature will just remove the other pieces of IT location if you want to keep it you can and I'll just format this one so that it's a validation so now it's a validation and the response I am getting response as current current dot Camp underscore C amp underscore app would be the my values whatever I get from the response of this call so I'm just saying import in the header it's having all these parameters as a part of header and responsible and in the body we have this stamp underscore C and tampon row score app so if you click on this and edit you will see the types for this the responses so number double and I'll just go back and actually save update my connector so now we'll just test this one I'll just go to test tab and I'll pick the connection which we latestly created with the new API key and over here you can specify your CD name to get the temperature and we'll just do the test operation and if I scroll down I got this body which body is having all the details and as you know like we have already extracted only this response temperature in Fahrenheit and Celsius so this is what we are going to uh look at into our power amps so now as the custom connector is already created so now the next step is we are going to leverage this custom connector into power apps directly to get the instant result so I am just going to make dot powerapps.com will create a canvas app and this would be that the call I would say and I'll just create it so in this now I'll just drop one control that would be let's say like a drop down because I am going to select the cities from a drop down and I'll directly buy my hard-coded cities for demo purpose New York London and let's see New Jersey so this would be my this drop down and before that I'll just go to the data because we have to actually add our custom connector as a data so I just click on add data and we'll try to find out my custom connector that is interactive weather and over here it is and I'll just select the latest connection which create which we created so now it's there and uh to depict to see the temperature I just drop one more label so that the temperature changes should be visible to us and I'll just say over here and just Zoom it a bit and on selection or on change of this drop down my connector should be called up with the input so I'll just see on change the connector name interactive whether API dot get when the data this was the action and in the parameter we have this queue text that means xcd name so I'll just say q and text would be drop down one dot selected dot value so this value should be passed to this Q parameter as a city name and after that like we have to extract the response out of it so as you know like we have trimmed down our response to just get the current temperature in Fahrenheit and Celsius I'll just use the Fahrenheits and this would be given thrown back to R is Interactive from interactive or data call so now we have this header for Json and now we got this interactive weather data API call temperature finite as response so but we need to set it up in a variable so that we can use it and variable name say temperature comma and the value of this Interactive call and I'll just close it so we set up this variable and this variable we are going to in turn use into are this label so I'll just set that as X for my this label so now we have this both the drop down and the label so I just run it once and I'll change my drop down to London and is making also 46.4 is Fahrenheit response what we get in New York is 37.9 so we are able to get the instant response from others API endpoint using this custom connector so if you could have gone through the way like where we were calling Custom connector in power to me it could have taken a slightly like it could be milliseconds or it could be like one second two second anything based on this connection response but this way it's pretty much instant like whenever you see a requirement of calling any API within your intranet or Internet or public one then just think about this way of having this custom connector in place and make that call instantly without actually getting any details so that's the intent of this video how you can leverage the custom connector and call or get the response back to any power apps instantly using this way so that's it for today's video I hope that you may find this useful because it was useful for me and if you actually like it do press that thumb icon and if you have any further question then feel free to drop me comments I'll be happy to answer that's it for today thank you
Info
Channel: M365 Tech Help
Views: 28,374
Rating: undefined out of 5
Keywords: PowerApp call API, Get API result in PowerApps, Custom connector with PowerApps, How to consume custom APIs output in PowerApps, How to create custom connector in PowerApps, PowerApp get instant response of API calls, Power Canvas App calling a custom connector, Read output from custom connector inside PowerApps, PowerApp custom connector call, Connect API in PowerApps using Custom connectors
Id: F8oeZ0WHM5Q
Channel Id: undefined
Length: 12min 23sec (743 seconds)
Published: Thu Mar 16 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.