Question

I've been using the endpoint https://updates.drupal.org/release-history/[module]/[version], where [module] is the module name and [version] is its version (as 8.x or 7.x). This endpoint, however, doesn't work for 9.x.

For example https://updates.drupal.org/release-history/search_api_solr/8.x works fine but https://updates.drupal.org/release-history/search_api_solr/9.x has nothing, although the module has releases compatible with Drupal 9.

Also, the endpoint for 8.x doesn't return new releases in SEMVER format.

How can I get module releases for Drupal 9? Why aren't SEMVER releases included?

Was it helpful?

Solution

You can use https://updates.drupal.org/release-history/search_api_solr/current to get the versions either prefixed with 8.x- or without an API compatibility prefix. (The latter is the case for SEMVER versions.)

The output from that URL contains information about this release, for example.

<release>
<name>search_api_solr 4.1.1</name>
<version>4.1.1</version>
<tag>4.1.1</tag>
<status>published</status>
<release_link>https://www.drupal.org/project/search_api_solr/releases/4.1.1</release_link>
<download_link>https://ftp.drupal.org/files/projects/search_api_solr-4.1.1.tar.gz</download_link>
<date>1591714636</date>
<files>
<file>
<url>https://ftp.drupal.org/files/projects/search_api_solr-4.1.1.tar.gz</url>
<archive_type>tar.gz</archive_type>
<md5>7f2dbc01229b118c02c66f4ac210d430</md5>
<size>3207604</size>
<filedate>1591714636</filedate>
</file>
<file>
<url>https://ftp.drupal.org/files/projects/search_api_solr-4.1.1.zip</url>
<archive_type>zip</archive_type>
<md5>511e33c0b0ae47a0bd455109f87d07d1</md5>
<size>3792678</size>
<filedate>1591714636</filedate>
</file>
</files>
<terms>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
</terms>
<security covered="1">Covered by Drupal's security advisory policy</security>
<core_compatibility>^8.8 || ^9</core_compatibility>
</release>

It also contains data for this release. (This shows that the URL doesn't return information only for SEMVER versions.)

<release>
<name>search_api_solr 8.x-3.9</name>
<version>8.x-3.9</version>
<tag>8.x-3.9</tag>
<status>published</status>
<release_link>https://www.drupal.org/project/search_api_solr/releases/8.x-3.9</release_link>
<download_link>https://ftp.drupal.org/files/projects/search_api_solr-8.x-3.9.tar.gz</download_link>
<date>1581700341</date>
<files>
<file>
<url>https://ftp.drupal.org/files/projects/search_api_solr-8.x-3.9.tar.gz</url>
<archive_type>tar.gz</archive_type>
<md5>5050a8e2bd6b4965d414cade7aae3dc8</md5>
<size>1052117</size>
<filedate>1581700341</filedate>
</file>
<file>
<url>https://ftp.drupal.org/files/projects/search_api_solr-8.x-3.9.zip</url>
<archive_type>zip</archive_type>
<md5>140f15134d4e8f2239b96e682186e021</md5>
<size>1278054</size>
<filedate>1581700341</filedate>
</file>
</files>
<terms>
<term>
<name>Release type</name>
<value>Bug fixes</value>
</term>
<term>
<name>Release type</name>
<value>New features</value>
</term>
</terms>
<security covered="1">Covered by Drupal's security advisory policy</security>
<core_compatibility>^8.7.7 || ^9</core_compatibility>
</release>

Unfortunately, there isn't a way to get all the versions that are compatible also with Drupal 9 and not just with Drupal 8, using an updates.drupal.org URL. For that, you need to parse the XML output and filter those versions containing ^9 in the <core_compatibility> tag.

As side note, the all, 8.x, 7.x end-points are considered legacy. I guess that means they could be removed in the future.

References

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top