At the moment the usage overview page on drupal.org gives an idea of the number of sites using a certain module. However as noted this includes information from only sites that include the update status module which means it is biased toward newer sites, is there a way to see an overview of the download statistics of a module as well in a similar view?
2 Answers
As you mentioned, d.o. has an API from which you can retrieve project information. For your purposes, you can retrieve module downloads with the following URL:
https://www.drupal.org/api-d7/node.json?type=project_module
The JSON output has a property called list
which is an array of node objects for each module project. Each node object contains a property called field_download_count
that contains the project's download count.
Note: results are paged (100 per result) from the web service so you'll have to iterate through 307 pages of results to get all module projects (the JSON output contains a first
, last
, prev
, next
property with URLs that let you navigate through the pages)
You can get information about a particular module in both XML
and JSON
format by accessing URL:
Eg: (For Views Module) :
XML format:
https://www.drupal.org/api-d7/node.xml?field_project_machine_name=views
JSON format:
https://www.drupal.org/api-d7/node.json?field_project_machine_name=views
Reference: https://www.drupal.org/api