In order to query the location of the Resource Group, you'll need to use Resource Group - Get, the response from this call will provide you with the Resource group's location:
GET https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}?api-version=2020-06-01
To get the location of a VM you can use the Virtual Machine - Get call:
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}?api-version=2020-06-01
All the information you're looking to query will be available by using a combination of these calls but there is currently not a single call that will return the response exactly as you're looking for so this will need to be accomplished programatically.