Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget package download count using C#

Tags:

c#

nuget

api

I'm looking for a way to get the count of nuget package downloads from my C# code. Is it possible? Is any auth required? I see feeds and odata being used for this already but I can't use them.

like image 837
nimisha shrivastava Avatar asked Nov 26 '13 10:11

nimisha shrivastava


1 Answers

A brief look at the API shows that the overall index is (for example) https://www.nuget.org/api/v2/Packages, with each id being the URL for a specific package, for example: https://www.nuget.org/api/v2/Packages(Id='protobuf-net',Version='2.0.0.668') which has a d:DownloadCount element, where d is an xml alias to http://schemas.microsoft.com/ado/2007/08/dataservices:

<d:DownloadCount m:type="Edm.Int32">73428</d:DownloadCount>

So: load the package page, and read the d:DownloadCount.

like image 134
Marc Gravell Avatar answered Oct 19 '22 09:10

Marc Gravell