手順
1.VBA-JSONの追加
以下を参照ください。
2.参照設定の追加
以下を参照ください。
3.VBAコードの追加
Microsoft Visual Basic for Applications を開き、次のコードを入力し、実行します。
Sub GetPage()
Dim ohttpReq As New XMLHTTP60
Dim dJsonParsed As Dictionary
Dim sUrl As String
Dim sJson As String
Dim label As New Dictionary
' ラベルを追加する
label.Add "name", "ラベル"
sJson = ConvertToJson(label, Whitespace:=2)
' エンドポイントのURLを指定する
sUrl = "https://<ConfluenceのベースURL>/rest/api/content/<ページID>/label"
' HTTPリクエストする
With ohttpReq
.Open "GET", sUrl
.setRequestHeader "Authorization", "Basic <Basic認証のユーザー名とパスワード(Base64エンコード)>"
.setRequestHeader "Content-Type", "application/json; charset=UTF-8"
.setRequestHeader "X-Atlassian-Token", "no-check"
.send (sJson)
Debug.Print .responseText ' HTTPレスポンスをイミディエイトに出力
End With
End Sub