For its Artifactory product,
JFrog offers a Java client API as a convenience
to using its REST API but as far as I can tell, all of the REST API
examples online are written in Groovy…
So, here’s a couple of quick examples written in Java (using version
0.17 of the Java client API) which leverage the Artifact and GAVC
searches, respectively.
Example 1: Artifact Search (Quick Search)
First, I instantiate an instance of the ArtifactoryImpl class. The cast
exists because, for some reason, the get, post, put, and delete methods
are not declared on the Artifactory interface (which the class
implements). Odd? I think so.
I then set the query path…
And the query parameters…
And the responseContentType…
And the headers…
And finally, I invoke the ArtifactoryImpl.get method…
Example 2: GAVC Search
The Artifactory API also allows you to search by GroupId, ArtifactId,
Version, and Classifier (GAVC) as well as using Artifact Search.
First, I instantiate an instance of the ArtifactoryImpl class. As in
Example 1, the cast exists because the get, post, put, and delete
methods are not declared on the Artifactory interface (which the class
implements).
I then set the query path…
And the query parameters…
And the responseContentType…
And the headers…
And finally, I invoke the ArtifactoryImpl.get method…
References
For information regarding the Artifactory REST API and, in particular,
the Artifact Search and GAVC Search: