artifactory-client-java
artifactory-client-java copied to clipboard
Exception: This REST API is available only in Artifactory Pro
Hi, when I operate repository, my process finished with exit. Here is my code
Artifactory artifactory = ArtifactoryClientBuilder.create()
.setUrl("http://192.168.1.**:8081/artifactory")
.setUsername("admin")
.setPassword("?????")
.build();
DebianRepositorySettingsImpl settings = new DebianRepositorySettingsImpl();
settings.setDebianTrivialLayout(true);
Repository repository = artifactory.repositories()
.builders()
.localRepositoryBuilder()
.key("NewRepoName")
.description("new local repository")
.repositorySettings(settings)
.build();
String result3 = artifactory.repositories().create(2, repository);
The exception is :``` Exception in thread "main" org.apache.http.client.HttpResponseException: { "errors" : [ { "status" : 400, "message" : "This REST API is available only in Artifactory Pro (see: http://www.jfrog.com/addons.php). If you are already running Artifactory Pro please make sure your server is activated with a valid license key.\n" } ]
That's what happens when I do any operation to User. I want to know that is my code wrong or something else.
@Zerozzzz, Your code looks okay. Are you using an Artifactory Pro server?
@eyalbe4 No, I using an Artifactory OSS, you mean the reason for the exception is the version. Only Artifacroty Pro can access some specific APIs.(I apologize for my poor English 😭)
No problem @Zerozzzz. These APIs are available for Artifactory Pro or Enterprise only. Let me know if there's anything else I can help you with.
I'm glad to have your help, but I have no doubt now.
Does repository creation through REST api require license? That's hindrance for open source developers to integrate with Artifactory. I was trying to automate a workflow to create repos in artifactory automatically and I am getting the same error. I was expecting that whatever feature is available in OSS Web UI will be available with REST api
I know this is old but I have to agree with @smsajid . I am building a small open source product to integrate with Artifactory. I'm trying to set up a set of integration tests in CI with the OSS container, and running into this. It's really a shame.
@briantist, @Zerozzzz & @smsajid, Thanks for using the Artifactory Java client.
You can start a Free Tier account on SaaS - https://jfrog.com/start-free/#ft. The Free Tier instance supports the repository creation REST API.
Here https://github.com/jfrog/project-examples/tree/master/artifactory-client-java-examples/gradle-example there is no word, that it's only for PRO release. As I understand for OSS it's not available.
I use OSS when I use https://www.myserver.info
I run into
Exception in thread "main" org.apache.http.client.HttpResponseException: status code: 404, reason phrase: 404 page not found
at org.jfrog.artifactory.client.impl.ArtifactoryImpl.newHttpResponseException(ArtifactoryImpl.java:229)
at org.jfrog.artifactory.client.impl.ArtifactoryImpl.get(ArtifactoryImpl.java:248)
at org.jfrog.artifactory.client.Artifactory$get.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:144)
at org.jfrog.artifactory.client.impl.RepositoriesImpl.list(RepositoriesImpl.groovy:62)
at org.jfrog.example.ClientExample.createNewRepository(ClientExample.java:88)
at org.jfrog.example.ClientExample.main(ClientExample.java:49)
and when I use https://www.myserver.info/artifactory
I run into
Exception in thread "main" org.apache.http.client.HttpResponseException: status code: 400, reason phrase: {
"errors" : [ {
"status" : 400,
"message" : "This REST API is available only in Artifactory Pro (see: jfrog.com/artifactory/features). If you are already running Artifactory Pro please make sure your server is activated with a valid license key.\n"
} ]
}
at org.jfrog.artifactory.client.impl.ArtifactoryImpl.newHttpResponseException(ArtifactoryImpl.java:229)
at org.jfrog.artifactory.client.impl.ArtifactoryImpl.put(ArtifactoryImpl.java:336)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrap.invoke(PojoMetaMethodSite.java:213)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.jfrog.artifactory.client.impl.RepositoriesImpl.create(RepositoriesImpl.groovy:37)
at org.jfrog.example.ClientExample.createNewRepository(ClientExample.java:103)
at org.jfrog.example.ClientExample.main(ClientExample.java:49)
@hannesa2 Thanks for your feedback, Please see my comment here - https://github.com/jfrog/artifactory-client-java/issues/203#issuecomment-1356724143
@yahavi Thanks for the answer. Please add anywhere (e.g main README.md) in a prominent position the info, that it works only with PRO version.
Hi @hannesa2, We really appreciate your important feedback.
The Artifactory Java client acts as a wrapper for the Artifactory REST API - https://www.jfrog.com/confluence/display/JFROG/Artifactory+REST+API. More specifically, the Create Repository REST API requires Artifactory Pro and above.
Each REST API has its own permissions and licensing level and these parameters also change from time to time. Therefore it is not practical to mirror the REST API documentation. Moreover - the returned response from Artifactory ("This REST API is available only in Artifactory Pro") is straightforward.
Notwithstanding, we'd appreciate any other suggestions for how to improve the Artifactory Java client and its documentation.
the returned response from Artifactory ("This REST API is available only in Artifactory Pro") is straightforward.
Theoretical yes. But because of an other error, it was very expansive to me, till I figured this out https://github.com/jfrog/artifactory-client-java/issues/362 and https://github.com/jfrog/project-examples/pull/343
I want to save the time of other guys