【问题标题】:Jenkins Uploading file from local machine to confluence REST API - GroovyJenkins 将文件从本地机器上传到融合 REST API - Groovy
【发布时间】:2017-10-19 18:02:38
【问题描述】:

所以我正在尝试在 Jenkins 中编写一个 groovy 脚本,该脚本从本地机器获取文件并推送到汇合页面。

我似乎找不到任何文档。

我找到了这段代码,而且我是 groovy 的新手,所以只是想确保我在正确的轨道上。如果有人能澄清他们的意思那将是很棒的,并让我知道我是否走在正确的轨道上?

def server = new XMLRPCServerProxy("http://confluence:8090/rpc/xmlrpc")//Here we would have the link to our confluence server
    def spaceKey = "Area" // not sure what spaceKey means
    def pageTitel = "FileUpload"//The title of the page we are uploading to
    def fileName  = "D:\\datamodel.pdf"//the file path 
    def contentType = "application/pdf"//file extensions
    def token = server.confluence2.login("UserName" , "Password")//confluence login credientials
    def page  = server.confluence2.getPage(token, spaceKey, pageTitel)//not sure
    def file = new File (fileName)
    server.confluence2.addAttachment( token, page.id, [ fileName: file.name, contentType:contentType ], file.bytes )

【问题讨论】:

  • 您正在使用已弃用的 XMLRPC,我建议您查看 REST API 并通过 REST 调用发送

标签: groovy confluence confluence-rest-api


【解决方案1】:

我正在处理相同的任务,但只找到 curl 的大小写。这是工作,但这并不时髦。

【讨论】:

    猜你喜欢
    • 2017-05-20
    • 2011-12-05
    • 2013-08-12
    • 1970-01-01
    • 2022-10-03
    • 1970-01-01
    • 1970-01-01
    • 2019-08-11
    • 2023-03-16
    相关资源
    最近更新 更多