title: SugarCRM REST API, how to get Contacts related to an Account
body: <p>I am using SugarCRM Pro 6.5.5. I am trying to do some integration into another application, so I need to do some API calls from that other application. I am using the REST API v2. At this point, I need to get a Contact that is related to an Account via the account ID. I have tried both <code>get_relationships()</code> and <code>get_entry_list()</code>, but I can't get either of them to work.</p>
  
  <p>Here's my input for <code>get_relationships()</code>: </p>
  
  <p><code>{"session":"eujfbfsfjgni98m0mivl6jm6r2","module_name":"Accounts","module_id":"c03d0649-0525-2f90-1206-50881e87d7dd","link_field_name":"contacts"}</code> </p>
  
  <p>I have tried many variations of this, and several other options, but nothing did what I wanted. This is the output from above: </p>
  
  <pre><code>stdClass Object
  (
      [entry_list] =&gt; Array
          (
              [0] =&gt; stdClass Object
                  (
                      [id] =&gt; 
                      [module_name] =&gt; Contacts
                      [name_value_list] =&gt; stdClass Object
                          (
                              [deleted] =&gt; stdClass Object
                                  (
                                      [name] =&gt; deleted
                                      [value] =&gt; 0
                                  )
  
                              [do_not_call] =&gt; stdClass Object
                                  (
                                      [name] =&gt; do_not_call
                                      [value] =&gt; 0
                                  )
  
                          )
  
                  )
  
          )
  
      [relationship_list] =&gt; Array
          (
          )
  
  )
  </code></pre>
  
  <p>I don't see how this information could ever be useful.</p>
  
  <p>Next up, I tried <code>get_entry_list()</code> with a query to select only the Contacts that had the given account ID. Here's my input for that: </p>
  
  <p><code>{"session":"8mol33e7kdq6girugu30dnt074","module_name":"Contacts","query":"accounts.id = 'c03d0649-0525-2f90-1206-50881e87d7dd'"}</code></p>
  
  <p>I am using <code>accounts.id</code> because I have read in similar questions, that is correct. I've tried many other things, like: <code>contacts.account_id</code>, <code>account_id</code>, etc. In every case, I get a MySQL error in the log stating the column is invalid.</p>
  
  <p><a href="https://stackoverflow.com/questions/12615498/sugarcrm-how-to-get-all-contacts-for-an-account-via-rest-api">SugarCRM: how to get all contacts for an account via REST API</a></p>
  
  <p>This question is relevant, and seems to be the exact same problem. I tried adding a <code>link_name_to_fields_array</code> option to my input, but no matter what value I provide, it results in the following MySQL error in the log:</p>
  
  <p><code>AND jt11.deleted=0 where (Array) AND contacts.deleted=0: MySQL error 1054: Unknown column 'Array' in 'where clause'</code></p>
  
  <p>Dafuq?</p>
  
  <p>Thanks.</p>