Create tickets with multiple attachments using REST web service

Moderator: crythias

Locked
ness
Znuny newbie
Posts: 5
Joined: 01 Jun 2015, 17:21
Znuny Version: 4.0.7
Real Name: Nestor Ruiz de Infante

Create tickets with multiple attachments using REST web service

Post by ness »

Hi All,

I have a problem creating tickets with attachments using REST web service. I can create tickets but if I try to send more than one attachments it creates the ticket with only the last one.

I wonder if my json is correctly formed:

Code: Select all

{
 "Ticket":{
			"Title":"REST Create Test", 
			"Type":"Test", 
			"Queue":"Test",
			"State":"open",
			"Priority":"3 normal",
			"CustomerUser":"customer"
		 }
 ,"Article":{
			"Subject":"Test Subject",
			"Body":"This is only a test",
			"ContentType":"text/plain; charset=utf8"
			}
 ,"Attachment":{
			"ContentType":"image/gif",
			"Filename":"img1.gif",
			"Content":"R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
			}
 ,"Attachment":{
			"ContentType":"image/gif",
			"Filename":"img2.gif",
			"Content":"R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
			}
}
Thanks in advance.
ness
Znuny newbie
Posts: 5
Joined: 01 Jun 2015, 17:21
Znuny Version: 4.0.7
Real Name: Nestor Ruiz de Infante

Re: Create tickets with multiple attachments using REST web service

Post by ness »

I found the solution. There was a mistake in the json.

The correct way to set attachments is this:

Code: Select all

{
 "Ticket":{
         "Title":"REST Create Test", 
         "Type":"Test", 
         "Queue":"Test",
         "State":"open",
         "Priority":"3 normal",
         "CustomerUser":"customer"
       }
 ,"Article":{
         "Subject":"Test Subject",
         "Body":"This is only a test",
         "ContentType":"text/plain; charset=utf8"
         }
 ,"Attachment":[
	 		{
        	 "ContentType":"image/gif",
	         "Filename":"img1.gif",
        	 "Content":"R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
	       }
 			,{
	         "ContentType":"image/gif",
	         "Filename":"img2.gif",
	         "Content":"R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
          }
       ]
}
ness
Znuny newbie
Posts: 5
Joined: 01 Jun 2015, 17:21
Znuny Version: 4.0.7
Real Name: Nestor Ruiz de Infante

Re: Create tickets with multiple attachments using REST web service

Post by ness »

Now the problem is that the web service is extremelly slow when is sending files.

It takes 5 minutes to send less than 1MB on files.

Someone knows any way to do this faster?
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Create tickets with multiple attachments using REST web service

Post by crythias »

Generally, I'd suggest not attaching and rather hosting the file somewhere and enclosing a link. This helps being faster and doesn't clog the pipes with the same file to multiple recipients or multiple receipt of the same attachment.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
ness
Znuny newbie
Posts: 5
Joined: 01 Jun 2015, 17:21
Znuny Version: 4.0.7
Real Name: Nestor Ruiz de Infante

Re: Create tickets with multiple attachments using REST web service

Post by ness »

Thank you for your reply crythias.

I tried with SOAP service and it is really fast.

Now I have another problem:
I have to attach big files, bigger than 50 MB.
I set Core::Web -> WebMaxFileUpload to 100 MB.
I tried attaching two files of 20MB each and it works fine, but then I tried with one of 50 MB and it threw a exception (OutOfMemory).

Are there more limitations per total attachments size or any other?
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Create tickets with multiple attachments using REST web service

Post by crythias »

I can't suggest anything more helpful. Note that the limit may be MySQL.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Locked