Open dostjh opened 2 years ago
I've added both methods, and these should be available with version 1.0.25. BUT I didn't have time yet to write test cases, the calls might just give an exception... I will do so ASAP, but I have to take care of my kid, and do not know how long that might take.
I though if you have time and have a test server, you can already start integrating the calls.
I managed to write a test case and I found some issue, which I fixed. In the build for that fix there was an error and it seems that Json wasn't serialized correctly, the destination information for the CopyAsync wass missing: {"destination":{"value":"550731777"},"pageTitle":"Copied page"}
I seem to have fixed it, if you do still get an error from Confluence "Invalid destination", that might be the issue. Anyway, got Dapplo.Confluence version 1.0.27 available with the copy & move.
Now I need to sleep, it's way past midnight.
@dostjh did you manage to have a look at this?
@Lakritzator sorry for the delay in reply. Was enjoying the holidays. :) I don't have access to a test server myself unfortunately, and I'd have to ask our team to integrate in your change to our artifactory instance at work, but I'll do that today and let you know the result there. Greatly appreciate your looking into this!
EDIT: I think I understand the problem. This API endpoint has been enabled for Confluence Cloud, but I don't think it has for Confluence Server which is the instance I'm running against, so I may be out of luck here. Hope others find your change useful, but I won't be much use in assessing the implementation. My apologies.
--ORIGINAL COMMENT--
So, I'm getting an error, but maybe I'm utilizing the code in correctly. The error is
null for uri: https://[path to instance]/confluence/rest/api/content/255657627/copy
Here is the relevant sample code I'm using:
var copyContent = new CopyContent()
{
CopyAttachments = true,
Destination = new CopyPageRequestDestination()
{
DestinationType = CopyDestinations.ParentPage,
Value = "182753302"
},
PageTitle = "Test Copy via API"
};
var result = _client.Content.CopyAsync(255657627, copyContent).Result;
If anyone who stumbles across this issue wants to follow this API method not being implemented for Confluence Server/Data Center, it's tracked here: https://jira.atlassian.com/browse/CONFSERVER-60397
I should have asked if it was for server or cloud!
I just added a check in the code, so you will get an exception, which makes the issue more clear.
Confluence REST API supports copying content from a source content to a target content. I'm working on a project today in Dapplo.Confluence that would have made extensive use of that call had it been available. As is, I'm having to copy the data from a source page, create or get a target page, and then copy each property of the source page into the target page.
https://community.developer.atlassian.com/t/added-move-and-copy-page-apis/37749