How to use CURLFile() with File Attachment of Incident
Summary
Fetch File Attachment from Incident and Pass it to CURLFile() function using PHPContent
As part of Integration, I need to pass an image file to REST API.
It was recommended to use CURLFile('') function for assigning file.
So, I need to get the file from a particular Incident's FileAttachment and assign it in JSON using PHP.
Find the bleow sample code for CURLOPT_POSTFIELDS.
CURLOPT_POSTFIELDS:
array('file'=> new CURLFILE('imagefile.jpg'),
'method' => 'method_name',
'api_key' => 'XXXXXXXAPIKEYXXXXXXX',
'body' => '{
"to":"to_number",
"type": "image",
"image" : {
"caption" : "Image File"
},
}',
'from' => 'from_number',
'format' => 'json')
How to get the file from Incident and pass it to CURLFILE('') function?
1