Create a File Change Comment

Creates a new file change record that contains a comment for a specific file version.

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:

Create a file change comment

URI

https://bartendercloud.com/api/librarian/files/{fileId}/filechanges/comment

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

fileId

Type: String

Specifies the ID of the requested file. Required.

Query Parameters

versionMajor

Type: Integer <int32>

Specifies the requested major version. Gets the latest version if both major and minor versions are not provided. Also gets the latest version if a major version is not provided and if minor versioning is not enabled in the space, regardless of the minor version value. Optional.

versionMinor

Type: Integer <int32>

Specifies the requested minor version. Required when minor versioning is enabled in the space; otherwise optional.

Example

Request body: See FileChangeCommentRequest.

Response: A FileChange object is returned that provides details about the file.

Copy
// Assume that fileId is the ID of the file that will receive the new comment.
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {accessToken}");

var addRequest = new FileChangeCommentRequest() {
    Comment = "This is a new comment"
};

HttpRequestMessage request = new HttpRequestMessage
{
   // Add the new comment to version 2.2 of the target file.
   RequestUri = new Uri($"https://bartendercloud.com/api/librarian/files/{fileId}/filechanges/comment?versionMajor=2&versionMinor=2"),
   Content = new StringContent(JsonConvert.SerializeObject(addRequest), Encoding.UTF8, "application/json"),
   Method = HttpMethod.Post
};

HttpResponseMessage msg = await client.SendAsync(request);

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