[PHP] New ticket with attachment
This is starting to get on my nerves now... I've got a PHP script that submits tickets but fails when attachments are added. Can anybody spot anything that's wrong?
The error I get is:
jSON response:Array ( [description] => Validation failed [errors] => Array (  => Array ( [field] => custom_fields [message] => Value set is of type String.It should be a/an key/value pair [code] => datatype_mismatch ) ) )
And then the curl options look like this:
cURL options:Array (  => 1  => https://apogeecorp.freshdesk.com/api/v2/tickets  => ####:####  => 1  =>  => 1  =>  =>  => Apogee Corp  => 1  => POST  => Array ( [name] => Marius Cucuruz [email] => email@example.com [subject] => TEST: new IT ticket via API (with attach) [description] => new IT ticket via API with PDF attachment [source] => 1 [priority] => 1 [status] => 2 [type] => IT [group_id] => 6000198310 [custom_fields] => Array ( [flag] => [cause] => Support Request [type_it] => IT Request ) [attachments] => CURLFile Object ( [name] => /var/www/intranet/wp-content/uploads/2018/04/1524152398.pdf [mime] => application/pdf [postname] => 1524152398.pdf ) ) )
If needed I can provide the PHP script too, though I reckon it's something I'm missing in the above. The request is done via POST and no headers are set with it.
What could it possibly be? I swear it was working a week ago...
Any help is greatly appreciated. Thanks in advance.
2 people have this question