Hi,
I’m trying to upload a file via an Aurena REST API. However I can’t figure out what I should use as in the FileData. I’m getting a message “Invalid value for property 'FileData'”. I’ve tried several encoding methods but I have had no luck yet.
Hi,
I’m trying to upload a file via an Aurena REST API. However I can’t figure out what I should use as in the FileData. I’m getting a message “Invalid value for property 'FileData'”. I’ve tried several encoding methods but I have had no luck yet.
Hi
It seems that you are sending an empty string "" for FileData.
It should be a Base64 encoded string.
Could you try the below?
"FileData": "dGVzdA=="
Cheers !
Dhananjaya.
Has anyone had any luck with this API?
Hi all. Until IFS Cloud is released, we have kept the documentation about this API in a separate document. It is attached here.
It seems that you are sending an empty string "" for FileData.
It should be a Base64 encoded string.
Could you try the below?
"FileData": "dGVzdA=="
No, FileData is a stream of bytes. The filename, set in that header, should be Base64-encoded though (and do NOT include the full path, it should only contain the filename, like “test.txt”).
Hi
Thank you for your response and the attached document. When I try to follow your document I get an error when I try to upload the file:
Is there something I’m doing wrong?
I’ve got this working by following the same documentation that Mathias provided. Not on a Cloud instance though. IFS10UPD9
Hi
Thank you for your response and the attached document. When I try to follow your document I get an error when I try to upload the file:
Is there something I’m doing wrong?
Hi
Try changing the Content-Type to application/octet-stream
Cheers !
Dhananjaya.
Hi
For CreateAndImportDocument.svc/EdmFileSet to work there are some important points which you need to note,
1. The document should be created by /CreateDocument endpoint with, "CreateFileRef": "YES"
2. Invoke the /GetDocumentUrl to get the URL for file upload.
3. The above would return a value like, "/int/ifsapplications/projection/v1/CreateAndImportDocument.svc/EdmFileSet(DocClass='100',DocNo='1000010',DocSheet='1',DocRev='A1',DocType='ORIGINAL',FileNo=1)/FileData"
4. Prepend the <host>:<port> to the value returned above to be used as the request URL for /EdmFileSet endpoint.
5. /EdmFileSet endpoint should be invoked using the PATCH method.
6. /EdmFileSet endpoint only support first time/fresh check in.
7. /EdmFileSet endpoint cannot be used to edit and check in the document again through this web service.
8. /EdmFileSet endpoint header should contain the below,
Content-Type:application/octet-stream
If-Match:ETag here
X-IFS-Content-Disposition:filename=<filename.extension_AS_A_BASE64_ENCODED_STRING>
9. No parameters for /EdmFileSet endpoint.
10. If the file is successfully uploaded then the response is none.
11. If you try to invoke the same request for /EdmFileSet endpoint again for the 2nd time, you will get an ODATA_PROVIDER_ERROR since you have already uploaded the document and only first time/fresh check in is supported.
Cheers !
Dhananjaya.
Do you spot any mistakes I’m making? Thank you.
Perhaps this is a stupid question, but have you added TXT files to the basic data in EDM Basic / File Types?
No, the API is the same. I think we added better error reporting in a later update though such that you can actually understand the underlying problem, but the rest of the code is the same.
FYI, when this API was added we did not have a proper place to keep the documentation. Hence the Word document that I attached a PDF version of above. In IFS Cloud that documentation will be part of the official/proper API documentation that we generate for all the available REST APIs.
Perhaps this is a stupid question, but have you added TXT files to the basic data in EDM Basic / File Types?
Not a stupid question . I have a file type TEXTFILE with the extension TXT in the Document File Types defined. Could there be any other setup I'm missing? Thanks for helping out.
Hi
I see that DocNo is not the same on your requests.
Further, are you able to check-in the same file using the same user and document class from the Application?
However, I have attached my Postman collection herewith. You could import and use that as a template for testing.
Please make sure that you change the authorization credentials and baseUrl variable.
Cheers !
Dhananjaya.
Hi,
To show how simple (well...) it can be to use this API to upload files I wrote a small script to upload a document using this API some time back. If you have Git Bash (or Bash packaged in some other way) you can use the attached script to test the API.
Remove the txt extension to run it then run it, like this:
bash $ . createandimportdocuments_community_edition.sh
The script requires Curl as well, for the actual upload. Also, please note the file grumpycat.jpg that needs to exist in c:\tmp. And, of course, the document class 200 need to exist and you need to have added JPG files to the basic data in Docman.
Read the comments in the script and make sure you understand the script before you run it.
Enjoy!
/Mathias
Thank you both very much for the help! This really helps me a lot.
Great! Any idea what you did differently?
Assuming you actually have Bash, is there an error? Again, the class, filename etc. must be changed according to your setup.
Hi
You are welcome and I'm happy to help
Further, it would be great to know what actually went wrong when you tried the same.
Cheers !
Dhananjaya.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.