Jump to content
  • 0

addReply via API with files


mesino

Question

Hi.

I am trying to use PHP-Curl to create a ticket via Blesta API and have a few queries:

As per my understanding, in order to create a new ticket you need two HTTP calls. One for add() and another for addReply(). Is that correct?

Secondly is there is working example of posting files along with the call to create a ticket. The parameter's explanation for it is a bit vague:

* @param array $files A list of file attachments that matches the global FILES array

Firstly I am not sure what should the structure of $files should be. Furthermore when I went through the code it appeared that the addReply method will only make use of '$files' array posted by API instead of $_FILES (only which can have the local 'tmp_name' of uploaded files).

$this->Upload->setFiles($files, false);

but $files is supplied remotely. I hope I am making some sense here.

Thanks.

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
3 hours ago, mesino said:

As per my understanding, in order to create a new ticket you need two HTTP calls. One for add() and another for addReply(). Is that correct?

Yes, that's correct.

3 hours ago, mesino said:

Secondly is there is working example of posting files along with the call to create a ticket. The parameter's explanation for it is a bit vague:


* @param array $files A list of file attachments that matches the global FILES array

Firstly I am not sure what should the structure of $files should be. Furthermore when I went through the code it appeared that the addReply method will only make use of '$files' array posted by API instead of $_FILES (only which can have the local 'tmp_name' of uploaded files).


$this->Upload->setFiles($files, false);

but $files is supplied remotely. I hope I am making some sense here.

You won't be able to submit files via the API; you essentially submit a reference to it. The files are expected to already exist in the server's temp directory (or whatever directory is set for 'tmp_name'), and then you provide details of that file (i.e. that reference) in the $files you submit via SupportManagerTickets::addReply. So, in order for you to attach a file to a ticket reply, you will first need to upload the file to the server separately.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...