Copy a Folder to Another Folder

Copies a folder to another folder.

Note: For more information about this command, including descriptions of any path and request parameters, request body schema, response codes and schemas, and payload examples, refer to the online API reference for this command at the following web page:

Copy a folder to another folder

URI

https://bartendercloud.com/api/librarian/folders/{folderId}/copy

Note: The bartendercloud.com domain that is referenced in the URI and in the code example that follows must be replaced with the contents of the DataCenterURI claim that is extracted from your access token. For more information, refer to Extracting the DataCenterURI Claim.

Path Parameters

folderId

Type: String

Specifies the ID of the source folder. Required.

Query Parameters

None.

Example

Request body: See FolderCopyRequest.

Response: See Folder.

Copy
// Assume that folderId is the ID of the folder that will be copied.
// Assume that  destinationFolderId is the ID of the location at which the copied folder will be created.
// Create a copy of a folder at the target location.
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {accessToken}");

var copyRequest = new FolderCopyRequest() {
    Name = "Label Designs 2",
    DestinationFolderId = destinationFolderId
};

HttpRequestMessage request = new HttpRequestMessage
{
   RequestUri = new Uri($"https://bartendercloud.com/api/librarian/folders/{folderId}/copy"),
   Content = new StringContent(JsonConvert.SerializeObject(copyRequest), Encoding.UTF8, "application/json"),
   Method = HttpMethod.Post
};

HttpResponseMessage msg = await client.SendAsync(request);

if (msg.IsSuccessStatusCode)
{
    return JsonConvert.DeserializeObject<Folder>(await msg.Content.ReadAsStringAsync());
}