Can anyone provide me code PHP code to create ticket with attachment and custom fields please.
Hello Ricardo,
Did you get a chance to brows through our PHP code samples listed in Github here?
Cheers!
Hello Aravind
That's right, but I get an error with the code they have for example on github
That's right, but I get an error with the code that has an example in github, this is the error:
{"description":"Validation failed","errors":[{"field":"attachments[]","message":"Unexpected/invalid field in request","code":"invalid_field"}]}
and in my code i have this
$filename = $_FILES['file']['name'];
$filedata = $_FILES['file']['tmp_name'];
$filesize = $_FILES['file']['size'];
$custom_fields = array(
"cf_clasificacin" => $clasificacion,
);
$ticket_payload = json_encode(array(
"description" => $descripcion,
"subject" => $asunto,
"email" => $correo,
"priority" => intval($prioridad),
"status" => intval($estado),
"cc_emails" => array("ram@freshdesk.com", "diana@freshdesk.com"),
"custom_fields" => $custom_fields,
"attachments[]" => curl_file_create($filename, $mimetype, $filedata),
));
Sign in to the Community
Social Login
Login for Freshworks Employees Login with LinkedInEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.