Ramya
Ramya

Reputation: 33

JFrog artifactory search API based on path after repos parameter

I'm using Jfrog Artifactory to store my build artifacts of maven type, I've setup repository as $ARTIFACT_BASEURL/MYREPO/TeamName/API_Name/api-1.0.0.jar, where MYREPO is the actual repository name and TeamName/API_Name is subfolder in it to store api specific artifacts. All good while I do API build and push the artifacts to their respective folders in MYREPO.

While I try to lookup at the repository using JFrog search API, it is not allowing subfolder/path in the search API, like I mentioned below,

Currently: curl -H X-JFrog-Art-Api:apikey “https://artifactory.company.com/artifactory/api/search/artifact?name=company&repos=MYREPO”

Expected: Curl -H X-JFrog-Art-Api:apikey “https://artifactory.company.com/artifactory/api/search/artifact?name=company&repos=MYREPO/TeamName/API_Name”
or:
Curl -H X-JFrog-Art-Api:apikey “https://artifactory.company.com/artifactory/api/search/artifact?name=company&repos=MYREPO&path=TeamName/API_Name”

so that I can do a lookup on the binaries stored in this path.

Please suggest/correct me in getting the process right

Thanks a ton!!

Upvotes: 3

Views: 4143

Answers (1)

Dror Bereznitsky
Dror Bereznitsky

Reputation: 20376

You mentioned that you are using Artifactory to store Maven artifacts. The current layout you are applying for your artifacts is not a standard Maven2 reposiotry layout. when using Maven typed repositories, Artifactory relies on having a correct layout and therefore the Artifactory search API will not be able to find your artifacts.
You are currently trying to use the quick search API, which only allow searching by artifact name. There are other types of search methods, for example the GAVC search which allows you to also search by the Maven groupId and version.
There are a couple of options:

(1) Conform to standard Maven repository layout and use GAVC search
(2) Work with a generic Artifactory repository and apply a custom layout which matches the current layout you are using. This will allow you to search for artifacts while keeping the current layout you are using.
(3) Keep your current setup and you the Artifactory Query Language (AQL) to search for artifacts based on path, for example:

items.find({"repo": "myrepo"}, {"path" : "a/b/c"}) 

Upvotes: 6

Related Questions