Jump to content
  • 0

addReply via API with files


Question

Posted

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.

2 answers to this question

Recommended Posts

  • 0
Posted
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.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...