The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to modify a confluence page with C#

Eric
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

TAGS
AUG Leaders

Atlassian Community Events