Using Artifactory's REST API and Groovy/Gradle to deploy jar file

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Using Artifactory's REST API and Groovy/Gradle to deploy jar file

petedog
Given this api deploy documentation, how would I use HTTPBuilder and Groovy to construct my query? I've tried multiple things but I'm not getting it right.


def http = new HTTPBuilder()
http.request('http://artifactory:8888/libs-snapshot-local/my/jar/1.0/test-jar-1.0.jar', PUT, JSON ) { req ->

        body = [
            uri: "http://artifactory:8888/libs-snapshot-local/my/jar/1.0/test-jar-1.0.jar",
            downloadUri: "http://artifactory:8888/libs-snapshot-local/my/jar/1.0/test-jar-1.0.jar",
            repo: "libs-snapshot-local",
            path: "c:\\pathtojarfile\\test.jar",
            created: "2012-02-03T08:37:12.599-0800",
            createdBy: "someuser",
            size: "1024",
            mimeType: "application/java-archive"

        ]

    response.success = { resp, json ->


    }

  }


This seems to get me part way there, but it uploads an empty jar file. Seems like the body is completely ignored. Removing it produces the same result. I can't seem to find a good reference on how this is done.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Using Artifactory's REST API and Groovy/Gradle to deploy jar file

Frederic Simon
It seems like there is a confusion,due to the documentation layout.
The JSON object is the response Artifactory will return on successful deployment, not a JSON to send in the body.

Hope this fix the misunderstanding, we will look in clarify the documentation.

Fred.

On Fri, Feb 10, 2012 at 2:09 AM, petedog <[hidden email]> wrote:
Given this api deploy
<a href="http://wiki.jfrog.org/confluence/display/RTF/Artifactory&#39;s+REST+API#Artifactory%27sRESTAPI-DeployArtifact" target="_blank">http://wiki.jfrog.org/confluence/display/RTF/Artifactory's+REST+API#Artifactory%27sRESTAPI-DeployArtifact
documentation , how would I use HTTPBuilder and Groovy to construct my
query? I've tried multiple things but I'm not getting it right.


def http = new HTTPBuilder()
http.request('http://artifactory:8888/libs-snapshot-local/my/jar/1.0/test-jar-1.0.jar',
PUT, JSON ) { req ->

       body = [
           uri:
"http://artifactory:8888/libs-snapshot-local/my/jar/1.0/test-jar-1.0.jar",
           downloadUri:
"http://artifactory:8888/libs-snapshot-local/my/jar/1.0/test-jar-1.0.jar",
           repo: "libs-snapshot-local",
           path: "c:\\pathtojarfile\\test.jar",
           created: "2012-02-03T08:37:12.599-0800",
           createdBy: "someuser",
           size: "1024",
           mimeType: "application/java-archive"

       ]

   response.success = { resp, json ->


   }

 }


This seems to get me part way there, but it uploads an empty jar file. Seems
like the body is completely ignored. Removing it produces the same result. I
can't seem to find a good reference on how this is done.


--
View this message in context: http://forums.jfrog.org/Using-Artifactory-s-REST-API-and-Groovy-Gradle-to-deploy-jar-file-tp7271186p7271186.html
Sent from the Artifactory - Users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Artifactory-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/artifactory-users



--


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Artifactory-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/artifactory-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Using Artifactory's REST API and Groovy/Gradle to deploy jar file

petedog
Yes, updating the docs would be useful. It's a little confusing when it says "Sample Usage" and then has the response below. Thanks for the quick reply, it was very helpful.
Loading...