Question on Dictionary Repeat

Hello all,
I’m using the COVID tracking APIs to try and generate some charts in Charty (https://covidtracking.com/data/api). They have a single call that returns a ton of historical data (https://api.covidtracking.com/v1/us/daily.json).

I want to use that and then loop on it to create the chart. So I started using the “Repeat with Each” action in Shortcuts. I want to only loop on the last 2 or 3 weeks though, and there is no way that I can find to only do that loop X number of times. Does anyone know a way to do that?

My work around at the moment is to do a call for each day, but that’s a lot of network calls and ends up being fairly slow. Here is a link to that version of the shortcut: https://www.icloud.com/shortcuts/8c04bbfdb49f4115953357479f621757

Any help here would be appreciated!

The following is a quick example of one way you might want to consider approaching this. In this example, the first 6 indexed dictionary entries are retrieved.

If the number of entries you want to retrieve remains constant (eg, always grab the first 14 or first 21 days as you describe) this could work.

1 Like

Thanks, that did exactly what I was looking for! Final shortcut here with Charty integration: https://www.icloud.com/shortcuts/f51b0eabffdd41b9893d75db358ca62c