Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to modify a confluence page with C#

Eric March 11, 2021

I want to change the webpage title  : <title>whatever I want</title> with c# code, so that I can build in the future dynamic pages.

I try a lot of things, but I cant change anything on the webpage, can anyone help me to give me some tips how to do that? 

string baseurl = "mywebpage";

string userpass = "username" + ":" + "password";

string json = "a json string" 

string encoded = Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(userpass));

string encval = "Basic " + encoded;

var content = new StringContent(json, Encoding.UTF8, "application/json");

HttpClient client = new HttpClient();

client.DefaultRequestHeaders.Add("X-Atlassian-Token", "nocheck");

client.DefaultRequestHeaders.Add("Authorization", encval);

client.DefaultRequestHeaders.Add("Accept", "json");

await client.PostAsync(baseurl+"/rest/api/content/"+pageid, content);

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events