I cannot figure out what fields or tags Yammer expects for my post variables when trying to post an attachment using the messages API. Yammer documentation says:
"The first method is the easiest, simply use file form elements with names attachment1 through attachment20. If there are a several attachments or the attachments are large it may take some time for a message to POST causing your application to appear to hang."
I read through the specification they said they are using RFC 1867 but still cannot get a simple text file or url (shown below) to post as an attachment. If I take out the attachement1
variable in the post array $jtext
then the body of the message will post as expected.
I'm also not entirely sure that this should be a multi-dim array.
Any help is appreciated!
This is written in PHP.
$jtext=array("body"=>$text,
"attachment1"=>array("type"=>"file","name"=>"https://www.google.com/"));
$url="https://www.yammer.com/api/v1/messages.json";
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$jtext);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer '.$accToken,'Content-Type: multipart/form-data'));
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$result = curl_exec($ch);