Get a Collection of File Changes |
Gets the file changes that are associated with a specific file.
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: |
URI
https://bartendercloud.com/api/librarian/filechanges
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
None.
Query Parameters
None.
Example
- C#
Request body: See GetFileChangeRequest.
Response: See FileChangeList.
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {accessToken}");
var getRequest = new GetFileChangeRequest() {
FileId = fileId,
Skip = 0, // Query from the first available record.
Limit 50 // Query 50 records at a time.
};
List<FileChange> histories = new List<FileChange>();
do
{
HttpRequestMessage request = new HttpRequestMessage
{
// Get the file changes.
RequestUri = new Uri($"https://bartendercloud.com/api/librarian/filechanges"),
Content = new StringContent(JsonConvert.SerializeObject(addRequest), Encoding.UTF8, "application/json"),
Method = HttpMethod.Post
};
HttpResponseMessage msg = await client.SendAsync(request);
if (msg.IsSuccessStatusCode)
{
var result = JsonConvert.DeserializeObject<FileChangeList>(await msg.Content.ReadAsStringAsync());
histories.AddRange(result.FileChanges);
if (result.GetFileChangesRequestDone)
break; // Exit loop when all content has been retrieved.
// Set up the next page query by using the pre-constructed query.
getRequest = result.NextGetFileChangesRequest;
}
else
{
break; // Error handling
}
} while(true);
return histories;