How to attach file to ticket and then create ticket using api?

25 views
Skip to first unread message

vaibhav1...@gmail.com

unread,
Aug 7, 2019, 6:29:45 AM8/7/19
to SherpaDesk API
I am creating ticket through my api using POST /tickets method.

My api url is like http://ncg1in-8d1rag:5nuauzj5pkfftlz3fmyksmyhat6j35kf@api.sherpadesk.com/tickets for insertion of ticket.

Ticket is getting inserted properly.

But what if I want to upload file at the time of insertion of ticket?

How to upload file along with ticket through api?



Eugene

unread,
Aug 7, 2019, 7:40:12 AM8/7/19
to SherpaDesk API
Hi,

yea, you cannot attach file before you create ticket
you need to do 2 calls:
1) create ticket
2) attach file

if you us cURL, just write filesname in initial post and attach file to new created tickets https://github.com/sherpadesk/api/wiki#post-file

if you want file to display file in initial post, you need to add this initial_post

"\n\nFollowing fil was uploaded: " + filesname +"."; then attach this file

Vaibhav shukla

unread,
Aug 8, 2019, 8:25:40 AM8/8/19
to SherpaDesk API
filesname is visible in initial post and But how to attach file to newly created tickets?

Eugene Tolmachev

unread,
Aug 8, 2019, 11:55:06 AM8/8/19
to Vaibhav shukla, SherpaDesk API

thanks I'll check

no more info needed




От: sherpad...@googlegroups.com <sherpad...@googlegroups.com> от имени Vaibhav shukla <vaibhav1...@gmail.com>
Отправлено: 8 августа 2019 г. 15:25
Кому: SherpaDesk API <sherpad...@googlegroups.com>
Тема: Re: How to attach file to ticket and then create ticket using api?
 
--
You received this message because you are subscribed to the Google Groups "SherpaDesk API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sherpadesk-ap...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sherpadesk-api/dc8e042c-1296-4c75-9419-e5b8ed396df6%40googlegroups.com.

SherpaDesk

unread,
Aug 12, 2019, 2:17:59 PM8/12/19
to SherpaDesk API

everything is right in your code

just small correction: https://stackoverflow.com/questions/19116016/what-...

curl -v -F 'upload=@\"C:/myfile.txt\"' http://api.sherpadesk.com/files?ticket=10184396

I also fixed error NullReferenceException



On Wednesday, August 7, 2019 at 1:29:45 PM UTC+3, vaibhav1...@gmail.com wrote:

Vaibhav shukla

unread,
Aug 21, 2019, 5:04:10 AM8/21/19
to SherpaDesk API

In this example,
POST /files

{
    "asset" : 123, -- (arbitrary) asset id where files will be added
    "ticket" : "ddg3jk", -- (arbitrary) ticket id where files will be added
    "post_id" : "123" -- (arbitrary) post id (from ticket post list) where files will be added (can be any post including initial post)
}   
this is post request.It accepts ticket id-ddg3jk,but where is the reference to file that is getting attached? How will it come to know which file are you going to attach to the ticket ddg3jk?
On Wednesday, August 7, 2019 at 3:59:45 PM UTC+5:30, Vaibhav shukla wrote:

Eugene Tolmachev

unread,
Aug 21, 2019, 7:07:46 AM8/21/19
to Vaibhav shukla, SherpaDesk API

yea sorry post https://api.sherpadesk.com/files/


you can add other input they will be send as parameters to api from form


see https://m.sherpadesk.com/app.html?ionicPlatform=ios#



<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<form action="https://api.sherpadesk.com/files/m4hqne" method="POST" enctype="multipart/form-data">
<label><b>Upload Image</b></label>
<div><input type="file" name="img" id="img" /> <button type="submit">Upload</button></div>
<input name="ticket" />
<input name="account"/>
<input name="post_id"/>
<input name="is_tech_only"/>

</form>
</html>




От: Vaibhav shukla <vaibhav1...@gmail.com>
Отправлено: 21 августа 2019 г. 13:56
Кому: Eugene Tolmachev <eug...@micajah.com>

Тема: Re: How to attach file to ticket and then create ticket using api?
 
The form not only contain upload file,but there is post request of other form fields which i handle on same action page.
How to embed following file action into my form page with other text fields and drop-downs?

On Wed, Aug 21, 2019 at 3:29 PM Eugene Tolmachev <eug...@micajah.com> wrote:

see below:

You can use most common and reliable multipart/form-data on posting files

SAMPLE PAGE

<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<form action="https://api.sherpadesk.com/files/m4hqne" method="POST" enctype="multipart/form-data">
<label><b>Upload Image</b></label>
<div><input type="file" name="img" id="img" /> <button type="submit">Upload</button></div>
</form>
</html>




Отправлено: 21 августа 2019 г. 12:04

Кому: SherpaDesk API <sherpad...@googlegroups.com>
Тема: Re: How to attach file to ticket and then create ticket using api?

--
You received this message because you are subscribed to the Google Groups "SherpaDesk API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sherpadesk-ap...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages