Nexus 3 REST api get repository info

Hi,

In case of Nexus 2 there is the option to get the remote URL for a proxy repo, and the member of a group repo using the /all_repositories and /repo_groups endpoints. In case of Nexus 3 according to the documentaion:

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

it should be possible, but for Nexus OSS 3.15.2-01 I do not see the ‘attributes’ key in the response. How can I extract this info?

Thanks,
Balázs

I suggest you update to the latest version, then you can use {{baseUrl}}/v1/repositories endpoint to list available repositories, and then ask for repository details at {{baseUrl}}/v1/repositories/:format/:type/:name. Example outputs are:
GET {{baseUrl}}/v1/repositories

[
    {
        "name": "maven-snapshots",
        "format": "maven2",
        "type": "hosted",
        "url": "http://localhost:8081/repository/maven-snapshots",
        "attributes": {}
    },
    {
        "name": "maven-central",
        "format": "maven2",
        "type": "proxy",
        "url": "http://localhost:8081/repository/maven-central",
        "attributes": {
            "proxy": {
                "remoteUrl": "https://repo1.maven.org/maven2/"
            }
        }
    },
    {
        "name": "maven-releases",
        "format": "maven2",
        "type": "hosted",
        "url": "http://localhost:8081/repository/maven-releases",
        "attributes": {}
    },
    {
        "name": "maven-public",
        "format": "maven2",
        "type": "group",
        "url": "http://localhost:8081/repository/maven-public",
        "attributes": {}
    }
]

GET {{baseUrl}}/v1/repositories/maven/group/maven-public

{
    "name": "maven-public",
    "format": "maven2",
    "url": "http://localhost:8081/repository/maven-public",
    "online": true,
    "storage": {
        "blobStoreName": "default",
        "strictContentTypeValidation": true
    },
    "group": {
        "memberNames": [
            "maven-releases",
            "maven-snapshots",
            "maven-central"
        ]
    },
    "type": "group"
}
1 Like

Hi @dsawa ,
Could you please tell me in which file we have to change this? Where this file is exist in Nexus3?