AnsweredAssumed Answered

Trouble returning deleted records with API

Question asked by Vaughn Okerlund on May 24, 2018
Latest reply on May 30, 2018 by Vaughn Okerlund



Using Postman, I'm attempting to return a list of contacts which includes records that have been deleted from Sugar. To do so, I'm sending a GET request to the Contacts end point and setting the deleted flag to '1'. However, the API responds with this error: 


"error": "unknown_error",
"error_message": "An exception occurred while executing 'SELECT contacts.last_name, contacts.assigned_user_id, contacts.acl_team_set_id, contacts.team_set_id, LTRIM(RTRIM(CONCAT(IFNULL(,''),' ',IFNULL(jt0_team_link.name_2,'')))) team_name, jt0_team_link.created_by team_name_owner, contacts.created_by, jt1_email_addresses_primary.email_address email1, contacts.salutation, contacts.first_name, contacts.title, account_id, jt2_accounts.assigned_user_id account_id_owner, account_name, jt2_accounts.assigned_user_id account_name_owner, jt1_email_addresses_primary.email_address email, contacts.phone_work, jt3_assigned_user_link.first_name rel_assigned_user_name_first_name, jt3_assigned_user_link.last_name rel_assigned_user_name_last_name, jt3_assigned_user_link.created_by assigned_user_name_owner, contacts.date_modified, contacts.date_entered, contacts.team_id,, contacts.deleted FROM contacts LEFT JOIN teams jt0_team_link ON (contacts.team_id = AND (jt0_team_link.deleted = ?) LEFT JOIN email_addr_bean_rel contacts_email_addresses_primary ON ( = contacts_email_addresses_primary.bean_id) AND (contacts_email_addresses_primary.deleted = ?) AND (contacts_email_addresses_primary.bean_module = ?) AND (contacts_email_addresses_primary.primary_address = ?) LEFT JOIN email_addresses jt1_email_addresses_primary ON ( = contacts_email_addresses_primary.email_address_id) AND (jt1_email_addresses_primary.deleted = ?) LEFT JOIN accounts_contacts accounts_contacts ON ( = accounts_contacts.contact_id) AND (accounts_contacts.deleted = ?) AND (accounts_contacts.primary_account = ?) LEFT JOIN accounts jt2_accounts ON ( = accounts_contacts.account_id) AND (jt2_accounts.deleted = ?) LEFT JOIN users jt3_assigned_user_link ON (contacts.assigned_user_id = AND (jt3_assigned_user_link.deleted = ?) WHERE () ORDER BY ASC LIMIT 1001 OFFSET 0' with params [0, 0, \"Contacts\", 1, 0, 0, 1, 0, 0]:\n\nYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY ASC LIMIT 1001 OFFSET 0' at line 1"

Am I doing something incorrectly in my request, or is it not possible to return deleted records? 


And my request: 



Am I doing something incorrectly in my request, or is it not possible to return deleted records?