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
Highlighted
Power Apps
Power Apps

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.

Highlighted
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 🙂
The way Launch passes key value pairs is really nice for parameterized URLs like this.
Highlighted
Super User III
Super User III

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.

 

 

 

 

 

Highlighted
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!!

Highlighted
Super User III
Super User III

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
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,279)