I'm using REST API quite often (using C# .NET packages) for more than a year and I always had trouble finding which HttpClient I need to use when I want to access a REST API endpoint. The documentation greatly improved on a lot of points (good job on that !) but this point is still lacking.
When you declare your VssConnection, you need to find the HttpClient you need :
// Connect to Azure DevOps Services
VssConnection connection = new VssConnection(new Uri(c_collectionUri), creds);
var client = connection.GetClient<XXXXHttpClient>();
Most of the time, you can guess it :
BuildHttpClient to access Build endpoint
GitHttpClient to access Git endpoint
And so on ...
Unfortunately, it's not always as easy.
For example, if you want to query the Task Group availables for your builds, you need to get a TaskAgentHttpClient that is available in another package (Microsoft.TeamFoundation.DistributedTask.WebApi). Not so easy to find.
Would that be possible to have a place somewhere when you know which HttpClient you need to use for every endpoint ?
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Hi @Gismork, I'm looking into this and will be in touch. Thanks for reaching out.
Hi @gismork, We've published recent changes to this article, including the dlls in the different nuget packages. Does this information help? Thanks!
Hi @chcomley, thank you for your answer. That's good to have the dlls and package mapping, it helps thanks again.
It still think it would be very useful to have a way to know which HttpClient you need to use when you want to query one endpoint. Not sure if it sometimes you could easily achieve. In all recent developments, it seems to follow the convention "
@Gismork, I've followed up with the dev team and they've let me know that they're looking into this, and will get back to me by early October. So...I'll be in touch then. I'm sorry it won't be sooner. Have a nice weekend.
@chcomley Any update on this. The discoverability of the clients is a major pain point in writing client code.
Hi @Gismork, @epvanhouten, and @ideoclickvanessa,
The product team has opened an internal work item to track this. That said, it's unlikely that this document will be updated anytime soon. I'm closing this issue, however if I get an update, I'll @mention you all. I'm sorry we don't have more for you. If you need some hands on help, please contact Support.
Most helpful comment
@chcomley Any update on this. The discoverability of the clients is a major pain point in writing client code.