cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Super User
Super User

Collect the "results" of a Launch()?

Hm. 
I can run the function below and get some JSON in a new browser window...:

Launch(
        "https://earthquake.usgs.gov/fdsnws/event/1/query?",
        "format","geojson",
        "starttime","2019-04-02",
        "endtime","2019-04-03",
        "latitude",Location.Latitude,
        "longitude",Location.Longitude,
        "maxradiuskm",300,
        "orderby","magnitude-asc"
    )

image.png

...but I can't collect it...

ClearCollect(
    colTest,
        Launch(
            "https://earthquake.usgs.gov/fdsnws/event/1/query?",
            "format","geojson",
            "starttime","2019-04-02",
            "endtime","2019-04-03",
            "latitude",Location.Latitude,
            "longitude",Location.Longitude,
            "maxradiuskm",300,
            "orderby","magnitude-asc"
        )
)

...just results in this Collection...

image.png

I would really like to use something like this for public API's rather than have to create a Custom Connector.

Any ideas on how to easily grab the response from this Launch() function?

Thanks!

5 REPLIES 5
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Collect the "results" of a Launch()?

At this moment you need a custom connector to be able to consume the JSON result that is returned by that API. If you feel that it should be made as part of the PowerApps language itself, please consider creating a feature request in the PowerApps Ideas board.

Super User
Super User

Re: Collect the "results" of a Launch()?

Right on. Thank you Carlos.
Sure feels like it wants to be a feature Smiley Happy
The way Launch passes key value pairs is really nice for parameterized URLs like this.
Super User
Super User

Re: Collect the "results" of a Launch()?

Hi @ericonline 

Perhaps you could try to do this with Flow, rather than Launch?

My initial thought would be to use an HTTP Action, similar to this.

https://flow.microsoft.com/en-us/blog/http-card-tutorial/

 

You could then use the Respond to PowerApps action to return the result to PowerApps, like @Mr-Dang-MSFT describes here. However, it would be easier than this article because you wouldn't need to translate the SQL output to JSON.

https://powerapps.microsoft.com/en-us/blog/return-an-array-from-flow-to-powerapps-response-method/

 

If this technique works, you could probably adapt it fix the other issue you mentioned with different parameters returning different schemas by using the 'branching' features of Flow.

 

 

 

 

 

Super User
Super User

Re: Collect the "results" of a Launch()?

Great idea @timl !

My other buddy too is always advocating for the use of Flow rather than Custom Connectors for REST calls.

Some pros of CC's vs. Flow:

  • Ease of creating and testing Custom Connectors ON THE BACK END (in the CC Definition and Test area).
  • Everything stays within PowerApps; Don't need to "go learn Flow" and all its snafus
    • Less moving parts
    • There are some licensing concerns too around # of calls per Flow to consider as well

Some cons of CC's vs Flow:

  • Calling API's from Custom Connectors can be challenging (in a ClearCollect Function).
    • Have to deal with "Default/Internal/etc." parameter settings and weirdness
    • Table() vs. "[ ]"
    • I've noticed it can take a while for a Custom Connector change to propagate to the "Front end" of PowerApps
    • Have to disconnect/reconnect/reset ConnecTIONS, etc. to jiggle the Custom Connector when a change occurs
  • Displaying results can be very challenging because there is not a lot of control of the returned schema, nested JSON, default responses, etc.
  • Can only have 1 GET call per URL!! (Whats that about?!)
    • Users have to authenticate to multiple Connectors in these cases (boo!)

Also in Flow, you get a better view into where your call is failing. You can create "breakpoints" of sorts and peek into whats happening at various points in the call/response. 

Hm... maybe i'm talking myself into Flow here!!

Super User
Super User

Re: Collect the "results" of a Launch()?

That's an excellent summary of CCs vs Flow. Thanks @ericonline !

I think you're talking me into Flow too!! The only other points I can think of are:

  • Flow comes with the O365 license so unlike CC, it's more easily available for those without a Plan1/Plan2 license
  • It's possible to carry out additional filtering/transformations in Flow before returning the results to PowerApps.

 

 

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 79 members 3,808 guests
Please welcome our newest community members: