Hi,
You can use the same API but not provide the part about the VM. Keep in mind that the API works only for VMs and a few other resources at subscription level and you need to provide region. You can only get the metrics for all VMs in a subscription in one region. If you have VMs in another region you need to make separate call.
Example call with ARM client is:
armclient get "/subscriptions/<sub id>/providers/microsoft.Insights/metrics?timespan=2020-09-14T06:30:00.000Z/2020-09-15T06:45:00.000Z&interval=PT15M&metricnames=Percentage CPU&aggregation=average&metricNamespace=microsoft.compute%2Fvirtualmachines&top=10&orderby=average desc&autoadjusttimegrain=true&validatedimensions=false&api-version=2017-12-01-preview®ion=westeurope"
(Please mark the reply as answer if it is the solution to your problem.