Hey guys and gals, this is my first post in the community so be gentle with me :).
I am trying to get usage logs from an API and have no issue making the query itself.
The issue is that in order to get monthly data I need to send an individual request for each month.
It seems silly to create a query for each month by subtracting the month using moment.js and im sure there is a more dynamic way to go about this.
Essentially I want to make 6 request for this month and the previous 5 months, as an end result im looking to generate an array containing the month and the usage like so in order for me to use the data in a bar chart:
[
{
"month": "January 2022",
"minutes": 125000000
},
{
"month": "December 2021",
"minutes": 850000
},
{
"month": "November 2021",
"minutes": 950000
},
{
"month": "October 2021",
"minutes": 950000
},
{
"month": "September 2021",
"minutes": 950000
},
{
"month": "August 2021",
"minutes": 700000
}
]
Any idea on what would be the best way to go about this ?