Hi,

I'm trying to search artifacts using a groovy script and the REST API:

def query = 
'artifactory/api/search/artifact?name=at.mic.all.feature&repos=features-qa-test-snapshot'
def server = new RESTClient('http://mic-build2.mic.co.at:8081')
server.parser.'application/vnd.org.jfrog.artifactory.search.ArtifactSearchResult+json'
 = server.parser.'application/json'
def resp = server.get(path: query)

this causes an exception:
groovyx.net.http.HttpResponseException: Bad Request
        at 
groovyx.net.http.RESTClient.defaultFailureHandler(RESTClient.java:240)
        at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:508)
        at groovyx.net.http.RESTClient.get(RESTClient.java:118)
        at groovyx.net.http.RESTClient$get.call(Unknown Source)
        at Artifactory.getArtifacts(artifactory.groovy:157)
...

Only to see if server and query are correct, I tried the url = server + '/' + 
query (= 
http://mic-build2.mic.co.at:8081/artifactory/api/search/artifact?name=at.mic.all.feature&repos=features-qa-test-snapshot)
 in a browser, that results in a file that contains exactly my search result:
{"results":[{"uri":"http://mic-build2.mic.co.at:8081/artifactory/api/storage/features-qa-test-snapshot/at/mic/all/feature/at.mic.all.feature/20130313002236/at.mic.all.feature-20130313002236-win32.win32.x86.zip"},.....}

So, my server and query seem to be ok, but won't work in my groovy script.

Thanks in advance for any help, kind regards!
Frank


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Artifactory-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/artifactory-users

Reply via email to