Using C#
{
// Get content by page ID
PageContent pageContent = await GetContentAsync(url);
// pageContent: {Body: null, Id: "900334136", Title: "GF Test page", Type: "page", Version: {Number: 5}}
// new version
Version ver = pageContent.Version;
ver.Number += 1;
// Extract body
pageContent = await GetContentAsync(url + "?expand=body.storage");
// Updating just title
pageContent.Version = ver;
pageContent.Title = pageContent.Title + "QQQ";
// pageContent: {Body: {Storage: {Representation: "storage", Value "<p>some text</p>"}, Id: "900334136", Title: "GF Test pageQQQ", Type: "page", Version: {Number: 6}}
PageContent newContent = await UpdateProductAsync(url, pageContent);
// - fails with 400, "Bad request"
}
static async Task<PageContent> UpdateContentAsync(string path, PageContent content)
{
HttpResponseMessage response = await client.PutAsJsonAsync(path, content);
response.EnsureSuccessStatusCode();
// Deserialize the updated content from the response body.
content = await response.Content.ReadAsAsync<PageContent>();
return content;
}
Any ideas why it does not work?
Thanks
Thank you for contacting us regarding this.
Could you help us understand what this is for exactly? I see you want to update pages in Confluence using API; is this for an add-on?
You might have better luck in our Atlassian Developer Community. That community is geared towards developers working with Confluence, creating add-ons, and custom modifications. You might find that the group there has some idea about how to correct this issue.
Regards,
Shannon
Hi Shannon,
This is about automated updating of the Wiki page with current data.
I will try my luck in Dev Community.
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for confirming, @Guennadi Filkov. I hope you find the answer you're looking for!
Regards,
Shannon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.