Skip to main content

Component Versions REST API

The Component Versions API returns a list of versions for a component. This API method is available via a POST resource:

POST api/v2/components/versions

In order to use the API you must know the component identifier for the component you wish to find the versions for. A non-exhaustive list of examples for various formats is provided.

Maven Example

When finding a version for a Maven component, an appropriate Maven component identifier must be used.

{
  "format": "maven",
  "coordinates": {
    "artifactId": "tomcat-util",
    "groupId": "tomcat"
  }
}

You can use cURL to run this request.

curl -u admin:admin123 -X POST -H "Content-Type: application/json" -d '{ "format": "maven", "coordinates": { "artifactId": "tomcat-util", "groupId": "tomcat" } }' 'http://localhost:8070/api/v2/components/versions'

Javascript Example

For Javascript components the a-name (authoritative name) must be used.

{
  "format": "a-name",
  "coordinates": {
    "name": "vizion",
    "qualifier" : ""
  }
}

You can also use cURL for this request.

curl -u admin:admin123 -X POST -H "Content-Type: application/json" -d '{ "format": "a-name", "coordinates": { "name": "vizion", "qualifier": "" } }' 'http://localhost:8070/api/v2/components/versions'

Python Example

For Python components a component identifier appropriate for the PyPI format must be utilized.

{
  "format": "pypi",
  "coordinates": {
    "name": "pyOpenSSL"
  }
}

This also has a corresponding cURL request.

 curl -u admin:admin123 -X POST -H "Content-Type: application/json" -d '{ "format": "pypi", "coordinates": { "name": "pyOpenSSL" } }' 'http://localhost:8070/api/v2/components/versions'

Response

You will receive a response containing a JSON array with the known versions sorted in ascending order. For the Maven example above, you will see something like the following.

[
  "3.2.1",
  "3.3.2",
  "4.0.6",
  "4.1.31",
  "4.1.34",
  "4.1.36",
  "5.0.16",
  "5.0.18",
  "5.0.28",
  "5.5.4",
  "5.5.7-alpha",
  "5.5.7",
  "5.5.8-alpha",
  "5.5.9-alpha",
  "5.5.9",
  "5.5.12",
  "5.5.15",
  "5.5.23"
]

Using Package-URL (PURL) Identifiers

This API supports retrieving component versions based on PURL identifiers. When finding a version for a Maven component an appropriate PURL identifier can be used.

{
  "packageUrl": "pkg:maven/tomcat/tomcat-util"
}

Here is an example cURL to run this request.

curl -u admin:admin123 -X POST -H "Content-Type: application/json" -d '{ "packageUrl": "pkg:maven/tomcat/tomcat-util" }' 'http://localhost:8070/api/v2/components/versions'

Similarly, for the same Javascript example above, the following cURL command can be used

curl -u admin:admin123 -X POST -H "Content-Type: application/json" -d '{ "packageUrl": "pkg:a-name/vizion" }' 'http://localhost:8070/api/v2/components/versions'