Not able to download iso from Nexus repo using cURL

I’m trying to test an issue in one of our environments. We have a Nexus repo that is a maven2 format, which holds multiple ISOs.

I’m trying to test download connectivity by using curl, however I’m getting a 404 error and not the JSON output as seen here. This is the command I’m using:

https://help.sonatype.com/repomanager3/rest-and-integration-api/search-api

curl -u user_id:password -X GET 'http://urlhere/nexus/repo/repo_I_want_is_here/search?repository=name of url here&group=goes here'

Can anyone offer better insight on how to go about this?

Hi Christopher,
You are using wrong request path. Just as the documentation you linked says, try using /service/rest/v1/search as your request path, or to use your example that would be curl -u user_id:password -X GET 'http://urlhere/service/rest/v1/search?repository=name of url here&group=goes here'

I guess I’m still not understanding as I tried what you recommended and getting the following html error output:

curl -u user_id:password -X GET 'https://nexus.server.url.here:8081/service/rest/v1/search?repository=https://nexus.server.url.here:8081&group=enter_group_id_here

This is the HTML error output here:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /service/rest/v1/search. Reason:
<pre>    Not Found</pre></p><hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.18.v20190429</a><hr/>

</body>
</html>

Based on your original request I’d think you should actually be using curl -u user_id:password -X GET 'https://nexus.server.url.here:8081/nexus/service/rest/v1/search?repository=repository_name&group=group_id where repository_name is the name of the repository the content is stored within and the group id is the maven2 groupId from the pom.xml. If you have the right permissions for your nxrm instance, you can log into the application, click the cog (admin menu), then go to System > API to find the live documentation. If you aren’t an admin you can still view the APIs but some of them won’t work depending on your permissions. Just go to https://nexus.server.url.here:8081/nexus/swagger-ui/. The trailing slash is important there I believe.

I got this to work from the CLI:

curl -u <user_id_goes_here>:<password_goes_here> -X GET ‘https://nexus_server:8081/nexus/service/rest/v1/search?repository=<repo_goes_here>&group=<group_id_goes_here>’

But this is giving me a json format view of files in that repo. I thought maybe I could use the URLs to download, however it didn’t work out.

I did use this:

curl -u <user_id_here>:<password_here> -o <path to url download here/repo/group_id:artifact_id:version_id:name_of_iso_here.iso>

And this worked successfully for me.

thanks