In a failover setup, is there a way to query both servers through Web Services API or any other http call to find out if it is currently Main or Failover?
This information is not available yet through the Web APIs. If you need it, you can create a new software feature task for it on Collaboration.
The method GetDataMinerAgentsInfo returns an array with the info of every DMA in the cluster, where an item representing a failover pair with a virtual IP will have IsFailOver set to true. But it's not possible to get the state of both severs yet.