Making a query while consuming an API
Its my first time consuming an API instead of building one with a db. Using SpaceXdata I'm trying to retrieve the year that had most launches.
I can use https://api.spacexdata.com/v3/launches to retrieve all the launches and use launch_year= as a param to retrieve all the launches in that year. But I don't know how to retrieve the year with most launches. Can someone helpe me? I don't know if I need to change my view or something in the request url.
My view.py:
def home(request):
response = requests.get('https://api.spacexdata.com/v3/launches')
launches = response.json()
return render(request, "main_app/home.html", {"launches": launches})