在xwiki中的PUT命令

时间:2015-06-08 09:48:52

标签: api rest put xwiki

我正在尝试使用put命令更改xwiki中页面的内容。 在wiki的其余API文档中:

HTTP Method: PUT
     Accepted Media types:
        application/xml (Page element)
        text/plain (Only page content)
        application/x-www-form-urlencoded (allowed field names: title, parent, content)
     Media types:
        application/xml (Page element)
     Description: Create or updates a page.
     Status codes:
        201: If the page was created.
        202: If the page was updated.
        304: If the page was not modified.
        401: If the user is not authorized.
我试过这样的事情:

$ curl -X PUT -text/plain -T"C:\Users\braimm\Desktop\text.txt" \
"http://localhost:8082/xwiki/rest/wikis/xwiki/spaces/Sandbox/pages/TestPage1/"

但它不起作用,似乎我必须指定媒体类型,有没有人尝试做类似的事情,我只想用PUT命令改变页面的内容。 感谢

1 个答案:

答案 0 :(得分:1)

我是这样做的:

$ curl -u user:password -X PUT -T "@content" -H "Content-Type: text/plain" \
       localhost:8080/xwiki/rest/wikis/xwiki/spaces/Sandbox/pages/{PageName}

这个改变了wiki中页面的内容