2016-10-11 46 views
-1

目前,我的任務是自動化我們公司的一些流程。其中之一是從Attlassian Confluence在我們的知識庫上自動創建頁面。Attlassian Confluence創建一個頁面

通常我是.Net開發人員,我不熟悉REST API。所以,我讀過的documentation這給了我下面的行創建一個新的頁面:

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/ 

我的問題是,我不知道,如何在C#中做到這一點。

+0

你有沒有試過谷歌「在C#中使用rest api」 – Thorarins

回答

1

我沒有代碼示例,因爲我通過PowerShell和ConfluencePS模塊完成了此操作。但是,大部分可以利用.Net框架來完成。

在情況下,它是對你有用,我建議你熟悉以下 - 一些它取決於你的.NET Framework版本(例如,4.5+):

  1. 基本身份驗證(和Base64編碼) 。
  2. JavaScript Object Notation(JSON)。
  3. System.Net.Http.Httpclient。
  4. System.Net.NetworkCredential。
  5. System.Net.Http.HttpClientHandler。