AnsweredAssumed Answered

Using SOAP or REST web service to retrieve note attachments and reading them

Question asked by community-support on Jan 13, 2014
Latest reply on Jan 13, 2014 by community-support
Hi,

Is there a way for these web services to reliably read a note attachment such as pdf's, .docs, .docx, rtfs, etc.? As it is now, I can retrieve the binary contents of the file using the get_note_attachment function in SOAP but somehow when I refer to it by itself, it cant display anything. My example function is this:

function getnoteattachments($login_info, $notes_list)

{

  $session_id = login($login_info);

  $client = display_client_errors($login_info[0]);

  $result = count($notes_list['entry_list']);

  for ($i = 0; $i  $session_id,

    'id' => $notes_list['entry_list'][$i]['id'],

   );

   try

   {

    $get_attachment_results = $client->call('get_note_attachment', $get_note_attachment_parameters);

   }

   catch (SoapFault $fault)

   { 

    var_dump($client->__getLastResponse());

    echo $fault->faultcode.'-'.$fault->faultstring;

    die('Sorry, the service returned the following ERROR: '.$fault->faultcode.'-'.$fault->faultstring.'.'); 

   }

   echo '';

   // print_r($get_attachment_results);

   echo '';

   print_r($get_attachment_results['note_attachment']);

   echo '';

   print_r($get_attachment_results['note_attachment']['id']);

   echo '';

   print_r($get_attachment_results['note_attachment']['filename']);

   echo '';

                 print_r($get_attachment_results['note_attachment']['file']);

   echo '';

}

The last print_r does not display anything but when I use unpack instead of print_r, it shows some values, implying that it's not empty but I'm just using the incorrect function. I've seen some forums say that there are some php libraries that enable you to read from these kinds of formats but I'm not sure which are the reliable ones. Help!

(from Alex Erm)

Outcomes