Using sonatype nexus 2.x, how do you get the sha1 or md5 hash of a file in a "site repository" (called "raw repositories" in nexus 3) using curl?
There is a related question on SO, however it only applies to "maven" repositories, which has a different api endpoint.
Take the download link and append ?describe=info
curl -H "Accept:application/json" \
"http://nexus.example.com/nexus/service/local/repositories/foobar/content/master-5678.zip?describe=info"
The optional -H "Accept:application/json"
curl flag returns json instead of xml
{
"data":{
"presentLocally":true,
"repositoryId":"foobar",
"repositoryName":"foobar",
"repositoryPath":"/master-5678.zip",
"mimeType":"application/zip",
"uploader":"bob",
"uploaded":1459458352000,
"lastChanged":1459458352000,
"size":715112200,
"sha1Hash":"d18dd27f4814e0898df98e7aa47cc08c477dfabc",
"md5Hash":"ded916cf74e7dd97e698285c2880e7a8",
"repositories":[
{
"repositoryId":"foobar",
"repositoryName":"foobar",
"path":"/master-5678.zip",
"artifactUrl":"http://nexus.example.com/nexus/content/repositories/foobar/master-5678.zip",
"canView":true
}
],
"canDelete":false
}
}
Thanks to Rich @ sonatype support.