Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception: This REST API is available only in Artifactory Pro #203

Open
Zerozzzz opened this issue Jul 10, 2018 · 12 comments
Open

Exception: This REST API is available only in Artifactory Pro #203

Zerozzzz opened this issue Jul 10, 2018 · 12 comments

Comments

@Zerozzzz
Copy link

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. 
@eyalbe4
Copy link
Contributor

eyalbe4 commented Jul 10, 2018

@Zerozzzz,
Your code looks okay. Are you using an Artifactory Pro server?

@Zerozzzz
Copy link
Author

@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 😭)

@eyalbe4
Copy link
Contributor

eyalbe4 commented Jul 10, 2018

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.

@Zerozzzz
Copy link
Author

I'm glad to have your help, but I have no doubt now.

@smsajid
Copy link

smsajid commented Oct 6, 2020

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

@briantist
Copy link

briantist commented Jun 9, 2022

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.

@yahavi
Copy link
Member

yahavi commented Dec 18, 2022

@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.

@hannesa2
Copy link

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)

@yahavi
Copy link
Member

yahavi commented Dec 18, 2022

@hannesa2
Thanks for your feedback,
Please see my comment here - #203 (comment)

@hannesa2
Copy link

@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.

@yahavi
Copy link
Member

yahavi commented Dec 18, 2022

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.

@hannesa2
Copy link

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
#362 and jfrog/project-examples#343

I want to save the time of other guys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants