SugarCRM: how to get all contacts for an account via REST API

babbata picture babbata · Sep 27, 2012 · Viewed 8.8k times · Source

I am trying to get all contacts for a particular account (i know the account id) from SugarCRM using the v2 REST API.

I am sending a GET request with the following parameters:

input_type => 'JSON'

response_type => 'JSON'

method => 'get_entry_list'

rest_data => '{session:"some-valid-session-id", module_name:"Contacts", query:"contacts.account_id=some-valid-id"}'

I expect to get all contacts that are related to this accoutn, but instead I get an error "... MySQL error 1054: Unknown column 'contacts.account_id' in 'where clause'"

However, when I try to get all contacts without providing any query (query='') I get all the contacts with all their properties and I can see that there is an account_id property.

Can anyone help?

Answer

air4x picture air4x · Sep 27, 2012

Try query:"accounts.id=some-valid-id".

It has worked for me in the past with the SOAP API.