【问题标题】:Uploading a file to Confluence using powershell使用 powershell 将文件上传到 Confluence
【发布时间】:2017-11-16 08:46:59
【问题描述】:

我正在尝试将文档添加到 Confluence 页面。

我正在使用此代码:

E:\APP\"curl-7.53.1"\src\curl.exe  -v -S -u user:password -X POST -H "X-Atlassian-Token: no-check" -F "file=@C:\Users\srvc_mdw_dev\Desktop\conf.txt" -F "comment=this is my file" "http://example.net/rest/api/content/36375143/child/attachment" 

但我收到以下错误:

PS E:\PowerShell\script> ./conf
Note: Unnecessary use of -X or --request, POST is already inferred.
* timeout on name lookup is not supported
*   Trying IPaddress...
* TCP_NODELAY set
* Connected to example.net (ip address) port 80 (#0)
* Server auth using Basic with user 'user'
> POST /rest/api/content/36375143/child/attachment HTTP/1.1
> Host: example.com
> Authorization: Basic c291aGFpbC5vdWFiaUBtZXRyb2V4dGVybmFsLmZyOm1ldHJvNDU2Kg==
> User-Agent: curl/7.53.1
> Accept: */*
> X-Atlassian-Token: no-check
> Content-Length: 333
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=------------------------646f724e33da0066
>
* HTTP 1.0, assume close after body
< HTTP/1.0 302 Found
< Location: https://example.net/rest/api/content/36375143/child/attachment
< Server: BigIP
* HTTP/1.0 connection set to keep alive!
< Connection: Keep-Alive
< Content-Length: 0
* HTTP error before end of send, stop sending
<
* Closing connection 0

有人知道我为什么会出现这个错误吗?谢谢你

【问题讨论】:

    标签: powershell curl confluence


    【解决方案1】:

    请查看以下 curl 命令 confluence rest api 文档。

    curl -u admin:admin -X POST -H 'Content-Type: application/json' -d'{"type":"page","title":"new page",
    "space":{"key":"TST"},"body":{"storage":{"value":"<p>This is a new page</p>","representation":
    "storage"}}}' http://localhost:8080/confluence/rest/api/content/ | python -mjson.tool
    

    https://developer.atlassian.com/server/confluence/confluence-rest-api-examples/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-08
      • 2017-02-11
      • 2014-05-15
      • 2013-12-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多