Skip to main content

API v2 Issue when creating a ticket with attachment


Hi, I've got an issue when trying to create a ticket via API v2.


I'm using PHP curl, and the details I'm passing are as follows:

array (size=7)
  'description' => string 'Test Test Test Test Test Test Test Test Test Test Test' (length=54)
  'subject' => string 'Mail subject' (length=12)
  'email' => string 'me@danielbell.co.uk' (length=20)
  'priority' => string '1' (length=1)
  'status' => string '2' (length=1)
  'group_id' => int 6000197799
  'attachments' => 
    array (size=1)
      0 => string '@/public/uploads/f3028783684500f6e99bbcb7edb549fa117c76ac.jpg' (length=61)


Here's what I'm actually passing via the CURL_POSTFIELDS (I've stripped 0 from the array so it's attachments[] and not attachments[0]:


description=Test+Test+Test+Test+Test+Test+Test+Test+Test+Test+Test&subject=Mail+subject&email=me%40daniel-bell.co.uk&priority=1&status=2&group_id=6000197799&attachments%5B%5D=%40%2Fpublic%2Fuploads%2Ff3028783684500f6e99bbcb7edb549fa117c76ac.jpg

description=Test+Test+Test+Test+Test+Test+Test+Test+Test+Test+Test&subject=Mail+subject&email=me%40daniel-bell.co.uk&priority=1&status=2&group_id=6000197799&attachments%5B%5D=%40%2Fpublic%2Fuploads%2Ff3028783684500f6e99bbcb7edb549fa117c76ac.jpg


And the following is an error I'm getting:

array (size=2)
  'description' => string 'Validation failed' (length=17)
  'errors' => 
    array (size=1)
      0 => 
        array (size=3)
          'field' => string 'attachments' (length=11)
          'message' => string 'Should be a valid format' (length=24)
          'code' => string 'datatype_mismatch' (length=17)

Can you advise on what I'm doing wrong and how to get the attachments working?


Thanks in advance.

Did this topic help you find an answer to your question?
This topic has been closed for comments