Get documents via WebApi, filtering on filetype

Hi, using the WebApi I need to find all documents on a contact that are either PDF or DOCX. Currently I haven't found a way to use that field directly in the archives, so my current workaround is to use the findDocument archive, and for each row found I need to make another call to the DocumentAgent.GetDocument and check each filename returned. The performance isn't very good doing it this way.

I can use the template type as a filter, because the filetype stored can be different than the template suggests.

Is there a way to filter the document list for only DOCX and PDF files in one call?

RE: Get documents via WebApi, filtering on filetype

Hello Frode,

Something like this?

https://xxx/sales/api/v1/Archive/dynamic?$select=document.id,document.name&$filter=document.name contains '.pdf' or document.name contains '.docx'

None of the defined archives include the 'name' column so using the dynamic provider is necessary.

By: David Hollegien 19 Oct 2020

RE: Get documents via WebApi, filtering on filetype

Thanks David, I'll try that. Not sure if I've tested that before in this project but that totally makes sense. I'll try and see if there are any other issues doing it that way.

Thanks

By: Frode Lillerud 19 Oct 2020