Assets API
Introduction
This set of endpoints is for interacting with assets directly.
Endpoints
List Assets
GET /service/rest/v1/assets
This endpoint allows us to iterate through a listing of assets contained in a given repository.
Let's get a listing of the assets in the maven-centralrepository:
curl -u admin:admin123 -X GET 'http://localhost:8081/service/rest/v1/assets?repository=maven-central'
This produces a response that is the first pages of many assets in that repository:
Example Response
{
"items" : [ {
"downloadUrl" : "http://localhost:8081/repository/maven-central/asm/asm/3.1/asm-3.1-sources.jar",
"path" : "asm/asm/3.1/asm-3.1-sources.jar",
"id" : "bWF2ZW4tY2VudHJhbDozZjVjYWUwMTc2MDIzM2I2MTRkZWJlOTExOGFjNjMwOQ",
"repository" : "maven-central",
"format" : "maven2",
"checksum" : {
"sha1" : "2eaa4de56203f433f287a6df5885ef9ad3c5bcae",
"md5" : "0c0e3e83d9ce7907334c5eb519dab10c"
}
},
...
],
"continuationToken" : "3f5cae01760233b6506547dc7be10e0b"
}This endpoint uses a pagination strategy that can be used to iterate through all the assets if desired. As of release 3.74.0, pagination defaults to offering 100 items at a time; this setting is not configurable.
Note that the ordering of assets is consistent across multiple queries and is not alphabetical.
Get Asset
GET /service/rest/v1/assets/{id}This endpoint allows us to get the details of an individual asset.
curl -u admin:admin123 -X GET 'http://localhost:8081/service/rest/v1/assets/bWF2ZW4tY2VudHJhbDozZjVjYWUwMTc2MDIzM2I2MjRiOTEwMmMwMmNiYmU4YQ'
Example Response
{
"blobCreated": "2018-08-25T15:00:50.408+00:00",
"checksum": {
"md5": "734c1c5f44166e088d100accdb4b1474",
"sha1": "7b6e93e5e6403323cd70a18829a33f6cb4c0388d"
},
"contentType": "application/java-archive",
"downloadUrl": "http://localhost:8081/repository/maven-central/org/apache/maven/plugins/maven-source-plugin/2.2.1/maven-source-plugin-2.2.1.jar",
"format": "maven2",
"id": "bWF2ZW4tY2VudHJhbDpjNzU0NTU3OWE3YTE1MzkwYTZjYTEyZGI5MDAxMWI2OQ",
"lastDownloaded": "2018-08-25T15:00:50.412+00:00",
"lastModified": "2018-08-25T15:00:50.408+00:00",
"maven2": {
"artifactId": "maven-source-plugin",
"extension": "jar",
"groupId": "org.apache.maven.plugins",
"version": "2.2.1"
},
"path": "org/apache/maven/plugins/maven-source-plugin/2.2.1/maven-source-plugin-2.2.1.jar",
"repository": "maven-central"
}
Delete Asset
DELETE /service/rest/v1/assets/{id}This endpoint can be used to delete an individual asset.
curl -u admin:admin123 -X DELETE 'http://localhost:8081/service/rest/v1/assets/bWF2ZW4tY2VudHJhbDozZjVjYWUwMTc2MDIzM2I2MjRiOTEwMmMwMmNiYmU4YQ'
A successful deletion will return no content, for example:
Example Response
HTTP/1.1 204 No Content Date: Fri, 19 Jan 2018 20:41:47 GMT ...