Closed andreleoni closed 4 years ago
Hi @andreleoni!
Accordingly to the documentation, we should support that scenario. Give me a couple of days to investigate this further.
Thanks!
Hey @andreleoni. I had a second look at this today, and I think I did find a way to accomplish what you want.
# assume you have zendesk api client instance:
client = ZendeskAPI::Client.new { ...your config goes here }
# create the attachment, that returns the upload token
attach = ZendeskAPI::Attachment.new(client, file: "/tmp/test.txt")
token = attach.save
# use that token in a newly created ticket
ticket = ZendeskAPI::Ticket.new(client, :comment => { :value => "new ticket", :uploads => token })
raise "error" unless ticket.save
# check the ticekt comment has an attachment
ticket.comments.first.attachments.first.file_name # should return "test.txt"
Let me know if this works for you
Hello.
We have a form that uploads the file assync with the ticket creation.
We need to first upload the file, and since the file is uploaded and we received the returned file "token" (like this doc https://developer.zendesk.com/rest_api/docs/support/attachments#upload-files), references the ticket that will be created with this attachments. (like
comments.uploads << "test.jpg"
, but referencing the already created attachment token).Does this gem support this scenario?
Thanks!