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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to modify a confluence page with C#

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
Community showcase
Published in Confluence

Confluence Mythbusters: Does Atlassian even use Confluence?

Hi, Confluence collaborators! As part of #Confluence-Collaboratory month, we’ve created a very special Mythsbusters segment, where we're dive into an interesting myth and uncover the truth behind i...

1,542 views 7 29
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you