From a browser, if I have a single ADFS (STS), when I attempt to access a SharePoint site, I can get the ADFS URL and realm from the redirect in HTTP reponse for authentication. If I have more than 1 STS servers configured on a SharePoint site, I will be prompted (Home Realm Discovery) with available realms and ADFS servers to select where to authenticate.
But is there a way to get these programmatically from SharePoint (not thru HTTP redirect or web page prompting), e.g. SOAP API or REST API?
There is no ADFS direct API.
There are AD FS 2.0 Cmdlets in Windows PowerShell.
The one you want is “Get-ADFSClaimsProviderTrust”.
You can access PowerShell from e.g. C#. Then you would just have to parse out the response.