7
鑑於此api documentation,我將如何使用HTTPBuilder和Groovy來構建我的查詢?我已經嘗試過很多東西,但是我沒有把它做好。使用Artifactory的REST API部署jar文件
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 ->
}
}
這似乎讓我有部分路,但它上傳了一個空的jar文件。好像身體完全被忽略了一樣。刪除它會產生相同的結果。我似乎無法找到一個很好的參考如何做到這一點。
這個工作!謝謝!該文件有點令人困惑。其中一些人說「樣本輸出」,一些人說「樣本用法」。部署的API有「示例用法」....我認爲這將是如何調用API。 – stuff22 2012-02-10 17:08:59