Solved

Upload VIEW-copy using CreateAndImportDocument.svc


Userlevel 4
Badge +8

When using CreateAndImportDocument.svc we invoke the CreateAndImportDocument.svc/GetDocumentUrl which returns a URL in the form of:
 

https://<cloud-environment>:<port>/int/ifsapplications/projection/v1/CreateAndImportDocument.svc/EdmFileSet(DocClass='<class>',DocNo='<no>',DocSheet='1',DocRev='A1',DocType='ORIGINAL',FileNo=1)/FileData

Now, uploading original works fine - but what about uploading the view copy? I’ve tried changing doctype to VIEW in URL (and yes, EDM basic has been setup to PDF = VIEW) etc but I’m kinda stuck.

If someone could point me in the right direction I would be very happy (extra ping goes to @Mathias Dahl  :) )

This is IFS Cloud21R2 atm I am testing against.

icon

Best answer by Mathias Dahl 21 May 2022, 12:56

View original

3 replies

Userlevel 7
Badge +30

Hi Andreas,

Good question!

Let me briefly explain how streaming (Important! We want to support really large files and the only way is to stream them) file uploads work in Aurena. Or in OData really, since that is the "standard" we use when working with REST.

In order to upload a file in a streaming manner in OData, which is done using the PATCH verb in HTTP, there must be a record to PATCH to.

Before you get the URL you posted above, you needed to create "the document" in Docman, with an action call (HTTP POST operation). When you have done that you can get hold of the URL you should then upload the file to. This works for the ORIGINAL file.

You cannot however also upload a VIEW file because there is no record to upload the file to (since you know our data model, what I'm talking about is a record in EdmFile). We simply didn't create a file reference record for a VIEW file when the document was created. We could have, but we didn't. In many cases it would not be used and the user would think there is a view copy there, when it is not.

Right now you cannot solve this problem, at least not with this API. And, actually, there might not be another one either that let you create a EdmFile record without also uploading a file. I could be wrong though (there might be an entityset for EdmFile records you can use in some of our projections and create (POST) a record that way).

At any rate, I think this API should have another method/action/operation as well, to cover this scenario. Since this is an integration API with Premium support we want it to handle the common use cases for which it was created, so I think we should add a way to add more file references to an existing document. My thinking is to allow adding any kind of file reference, apart for the ORIGINAL, which already exist. In most cases it would be a file ref with Document Type = VIEW, but perhaps someone wants to upload "other" document types as well.

Can you file a support case for this, or file an idea in the Idea section here on IFS Community? You can refer to this discussion there.

Thanks!
 

Userlevel 4
Badge +8

Thx for the reply Mathias, I looked around to see if there was another projection that supported this, and tried using std functionality in IFS Cloud - but it doesn’t seem to be possible using std either to create a view copy - I assume it will then be implemented forward, or will it perhaps be completely removed? Any pointers? :) 

Userlevel 7
Badge +30

We're not going to remove the support for view copies. The reason it's hard to find a projection that allows it is that there is no way in Aurena today to create a view copy without having the Aurena Agent installed. Although the Aurena Agent also uses projections for all file handling, there are some special handling involved for view copies that is not easy to mimic.

I think you should file an idea about this here on IFS Community. I think there should be a way to do this using that API you tried, and it also would not hurt to make it possible also to upload a view copy without the Aurena Agent, for example from the File Refs tab in Document Revision.
 

Reply