You are viewing limited content. For full access, please sign in.

Question

Question

Laserfiche API - How to get file extension using API?

asked on November 17, 2023

Hi,

In C#, how do I get the extension of an Document given its Id (Using Laserfiche.Repository.Api.Client)?  With curl, it's easy to do - just append a querystring with value "extension" at the end of the URL(albeit, it gives me a different structure than Entry), but I don't quite know how to do it with the API. I thought  I could do it this way with EntriesClient?

client.EntriesClient.GetEntryAsync(repoId, entryId, select="extension");

I thought I'd use "select", which came from the Swagger playground input box labeled "Select" and entering "extension" actually gives me the file extension, but that's from Swagger. But intellisense seems to indicate that "select" in the GetEntryAsync refers to type of Entry, i.e., Document, Folder, etc. 

So, how do I query the file extension with the API?

0 0

Answer

APPROVED ANSWER
replied on November 17, 2023

Hi,

There is no need to use "Select". If the entry type is Document, it would automatically get the extension. You just need to do a type conversion to Document and get it. Please see the following code for how to do it.

When using select, only the selected properties would return in response. And it seems that our client has issue converting the response to the Entry data type in that case. We will look into the issue and fix it soon.

2 0
replied on November 17, 2023

If you do want to use Select, the workaround for now is to also include entryType like

var doc = await client.EntriesClient.GetEntryAsync(new GetEntryParameters()
{
    RepositoryId = repositoryId,
    EntryId = 124892,
    Select = "entryType,extension"
}).ConfigureAwait(false);

 

1 0

Replies

replied on November 17, 2023

Thank you very much! I had figured it out as much after I posted my question. Thanks for the prompt reply. I appreciate it!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.