Service Desk Practitioners Forum
cancel

Attach file to service call using web-api

Highlighted
Eric Blanchet
New Member.

Attach file to service call using web-api

Hi all,
I searched for the answer in the forum but did not find something to solve my issue.

Here is the situation: I have a tomcat server that runs the application with the web-api.jar. It connects to an OVSD server, hosted on a different machine. I can create service calls but can not attach files.
I have the exception:
java.lang.RuntimeException: Error when put file myfile to attachment server: java.io.FileNotFoundException: myfile (No such file or directory)
I use the exmaple9.java code but no chance since the tomcat server and OVSD server are two different machines.
I saw something for transfering the file using FTP to the OVSD server but no explicit solution.

Do you have any idea to attach the file ?
2 REPLIES
Radovan Skolnik
Acclaimed Contributor.

Re: Attach file to service call using web-api

Blanchet,

this problem is very common. The issue here is (not stated explicitly anywhere) that when you specify the path and name of the file in WEB-API that filename and path has to be on SD's filesystem (!!! - so not the path on filesystem where WEB-API is running at). So you have to create a way to upload the file to SD's filesystem first, then call WEB-API to actually attach it. SD will pick up the file from its filesystem and upload it to FTP.

Also, when you'll be providing the way to retrieve the attachments, you will have to get them from FTP directly. I believe you can retrieve FTP credentials through IGeneralSettings.

WEB-API lacks any method to move the files between different hosts :-(
Eric Blanchet
New Member.

Re: Attach file to service call using web-api

Thanks Radovan,
I now realize I have to manually transfer the file on the SD server.