Get a File's Properties by the File Path

Gets the properties of the target file by using the file path.

Properties reflect all the information that is known about a given file version, including its metadata and attachments, when it was created, and who created it. The only data that is not included is the explicit permissions, which you can retrieve by using the Get a File's Permissions API.

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:

Get a file's properties by the file path

URI

https://bartendercloud.com/api/librarian/files/path/{filePath}/properties

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

filePath

Type: String

Specifies the path of the file. Required.

 

Comment: The {filePath} parameter must be single-URL encoded, and the path must start with the "librarian://{spaceName}/" prefix. Replace {spaceName} with the name of the target space (such as Main or $temp).

For example, the actual path for the file named "My File.txt" in the "My Folder" folder in the Main space is as follows: 

librarian://Main/My Folder/My File.txt

The URL-encoded {filePath} parameter is as follows:

librarian%3A%2F%2FMain%2FMy%20Folder%2FMy%20File.txt

The full URI would resemble the following: 

https://bartendercloud.com/api/librarian/files/path/librarian%3A%2F%2FMain%2FMy%20Folder%2FMy%20File.txt/properties

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: None.

Response: See File.

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

HttpResponseMessage msg = await client.GetAsync($"https://bartendercloud.com/api/librarian/files/path/{filePath}/properties?versionMajor={majorVersion}&versionMinor={minorVersion}");

if (msg.IsSuccessStatusCode)
{
   var response = await msg.Content.ReadAsStringAsync();
   return JsonConvert.DeserializeObject<File>(response);
}