Quantcast
Channel: All Developer posts
Viewing all articles
Browse latest Browse all 48650

Re: Connect to API via Power Query troubleshot

$
0
0

Hi @APIRT ,

 

Here I agree with lbendlin, I can connect to the REST API with his code.
According to your request url, you just need to add a since parameter in Query.

let Source = Json.Document(Web.Contents("https://api.hevyapp.com", [RelativePath="v1/workouts",Query=[page="1",pageSize="5",since="1970-01-01T00:00:00Z"],Headers=[accept="application/json", #"api-key"="..."]])), #"Converted to Table" = Table.FromList(Source[workouts], Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id", "title", "description", "start_time", "end_time", "updated_at", "created_at", "exercises"}), #"Expanded exercises" = Table.ExpandListColumn(#"Expanded Column1", "exercises"), #"Expanded exercises1" = Table.ExpandRecordColumn(#"Expanded exercises", "exercises", {"index", "title", "notes", "exercise_template_id", "superset_id", "sets"}, {"index", "title.1", "notes", "exercise_template_id", "superset_id", "sets"}), #"Expanded sets" = Table.ExpandListColumn(#"Expanded exercises1", "sets"), #"Expanded sets1" = Table.ExpandRecordColumn(#"Expanded sets", "sets", {"index", "set_type", "weight_kg", "reps", "distance_meters", "duration_seconds", "rpe"}, {"index.1", "set_type", "weight_kg", "reps", "distance_meters", "duration_seconds", "rpe"}) in #"Expanded sets1"

It works well in my test as well.

vrzhoumsft_0-1724744970341.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 


Viewing all articles
Browse latest Browse all 48650

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>