Skip to content
Toby Crawley edited this page Dec 28, 2024 · 7 revisions

Clojars provides a couple of data feeds which you might find useful.

API

Restful API provides few endpoints which can be used to retrieve data for users, groups and artifacts. The API supports multiple output formats which can be selected using the request's Accept-header.

Example:

curl -H "Accept: application/edn" https://clojars.org/api/groups/cljsjs

Formats

Format Content-type
JSON (default) application/json
EDN application/edn
YAML application/x-yaml
Transit application/transit+json

Endpoints

Note that the download counts provided by the API are calculated once daily, at 07:00 UTC.

User: https://clojars.org/api/users/{{user}}

Example: https://clojars.org/api/users/deraen

Group's artifacts: https://clojars.org/api/groups/{{group_name}}

Example: https://clojars.org/api/groups/cljsjs

Artifact: https://clojars.org/api/artifacts/{{artifact_name}}

Example: https://clojars.org/api/artifacts/leiningen

Artifact: https://clojars.org/api/artifacts/{{group_name}}/{{artifact_name}}

Example: https://clojars.org/api/artifacts/cljsjs/react

Release feed: https://clojars.org/api/release-feed?from=yyyy-MM-ddTHH:mm:ssZ

Returns a page (up to 500 results) of releases after the given timestamp. Each response includes a next_from property, which is the timestamp that can be used to get the next page.

If you are paging through the results, you should not consider a response with less than 500 results to be the last page, as a page can be smaller than 500 to avoid the page boundary falling in a millisecond where there are multiple releases (resulting in releases dropped from the feed). If paging through results, you should continue until you get an empty releases array.

You can store the next_from value from that last response, and use it in the future to continue paging subsequent releases.

Example: https://clojars.org/api/release-feed?from=2024-12-22T12:00:00Z

The response has the form:

{
  "next_from": "2024-12-23T10:04:44.520Z",
  "releases": [
    {
      "artifact_id": "cognitect-http-client",
      "group_id": "org.tcrawley",
      "released_at": "2024-12-22T15:09:42.491Z",
      "version": "1.11.130"
    },
    {
      "artifact_id": "next.jdbc",
      "group_id": "com.github.seancorfield",
      "released_at": "2024-12-22T18:42:28.598Z",
      "version": "1.3.999-SNAPSHOT"
    },
    ...
  ]
}

JSON search results

Add &format=json to the end of the normal search URL to get a JSON version of the results (click to see the format):

https://clojars.org/search?q=incanter&format=json

If the search query is invalid, the response will have a status of 400, and have only an error key (example).

XML search results

Add &format=xml to the end of the normal search URL to get a XML version of the results (click to see the format):

https://clojars.org/search?q=incanter&format=xml

If the search query is invalid, the response will have a status of 400, and have only an error element (example).

List of POM files

https://repo.clojars.org/all-poms.txt
https://repo.clojars.org/all-poms.txt.gz

It looks like this:

./compojure/compojure/0.3.2/compojure-0.3.2.pom
./compojure/compojure/0.4.0-SNAPSHOT/compojure-0.4.0-20100308.145053-1.pom
./compojure/compojure/0.4.0-SNAPSHOT/compojure-0.4.0-20100308.145053-2.pom

This list is regenerated once per hour.

List of jars and versions (in Leiningen syntax)

https://repo.clojars.org/all-jars.clj
https://repo.clojars.org/all-jars.clj.gz

It looks like this:

[compojure "0.3.2"]
[compojure "0.4.0-SNAPSHOT"]
[concurrent "1.3.4"]

This list is regenerated once per hour.

Useful extracts from the POMs

https://repo.clojars.org/feed.clj.gz

The format is Clojure maps, one per line. It looks like this:

{:description "Swank server connecting Clojure to Emacs SLIME", :scm {:connection "scm:git:git://github.com/technomancy/swank-clojure.git", :developer-connection "scm:git:ssh://git@github.com/technomancy/swank-clojure.git", :tag "1e4a12001bb52c4341b9bfbe1d9439cf698bc1e1", :url "https://github.com/technomancy/swank-clojure"}, :homepage "https://github.com/technomancy/swank-clojure", :group-id "org.tcrawley", :artifact-id "swank-clojure", :url "https://github.com/technomancy/swank-clojure", :versions ["1.5.0-sd" "1.5.0-sd-SNAPSHOT"], :versions-meta [{:version "1.5.0-sd", :release-date #inst "2012-03-08T21:38:31.525000000-00:00", :scm-tag "1e4a12001bb52c4341b9bfbe1d9439cf698bc1e1"} {:version "1.5.0-sd-SNAPSHOT", :release-date #inst "2012-03-02T02:38:34.060000000-00:00", :scm-tag "c9a36c5910c00416e26c698b542b617ac5066ffb"}]}
{:description "TJP Extensions for Clojure", :scm {:connection "scm:git:git://github.com/timothypratley/tjpext.git", :developer-connection "scm:git:ssh://git@github.com/timothypratley/tjpext.git", :tag "0afe7de60218d2a7fbf5ddd510a3644350b06cf6", :url "https://github.com/timothypratley/tjpext"}, :group-id "tjpext", :artifact-id "tjpext", :versions ["1.0.0-SNAPSHOT"], :versions-meta [{:version "1.0.0-SNAPSHOT", :release-date #inst "2010-02-25T13:43:47.766000000-00:00", :scm-tag "0afe7de60218d2a7fbf5ddd510a3644350b06cf6"}]}

This list is regenerated once per hour.

Lucene index of Maven artifacts

Generated by the Nexus Indexer. This should be usable by M2eclipse, Netbeans, Nexus etc for searching jars.

https://repo.clojars.org/.index/

See Sonatype's blog post for more about how to use this.

Download stats

Daily download stats are calculated and stored at https://repo.clojars.org/stats/downloads-yyyyMMdd.edn.

There is a combined file of downloads for all time at

https://repo.clojars.org/stats/all.edn.

New stat files and the combined all.edn file are generated daily. Older stat files are immutable and can be cached indefinitely. N.B. There are some gaps in the date range. You can see a list of all stat files at

https://repo.clojars.org/stats/.