asmd ashdkj
asmd ashdkj

Reputation: 133

How can I get components in repository via nexus3 api?

I have a raw repository in nexus3, named "marvel". In the repository I have about 5000 components with the name "spiderman" in them (e.g. "spiderman-22", "directory/spiderman-tar", etc).

I want to get a list of the components in the repository.

I saw in their website a way to get components via api:

curl -u admin:admin123 -X GET 'http://localhost:8081/service/rest/v1/components?repository=marvel'

I have two issues:

  1. I don't get all the components from the api (they probably have a limits - and I need about 5000 components).
  2. How do I add search for the api (i.e. only components with the name "spiderman")?

Upvotes: 1

Views: 2520

Answers (1)

Zeitounator
Zeitounator

Reputation: 44615

  1. I don't get all the components from the api (they probably have a limits - and I need about 5000 components).

Every needed API endpoint is paginated. As explained in the documentation, you have to call the same uri with a continuation token e.g.:

GET /service/rest/v1/<api>?<query>&continuationToken=88491cd1d185dd136f143f20c4e7d50c
  1. How do I add search for the api (i.e. only components with the name "spiderman")?

By using the dedicated search API endpoint

Note that you can have a view over the API and try it out from your browser by calling the swagger page on your own nexus installation: http(s)://your.nexus.server/swagger-ui/

You can also navigate to it from Server Admin > System > API.

Upvotes: 1

Related Questions