SugarCRM API Documentation on SugarAPI exceptions and error messages (./help/exceptions) Endpoint Method Description Exceptions Score POST /:/addRelatePersonalJobs addRelatePersonalJobsF Prepare and Return data for different Columns of BD Report None 8.25 GET /<module> filterList List of all records in this module Not Found (./help/exceptions#sugar-api-exception-not-found), Error (./help/exceptions#sugar-api-exception-error), Invalid Parameter (./help/exceptions#sugar-api- exception-invalid-parameter), Not Authorized (./help/exceptions#sugar-api-exception-not-authorized) 6.25 Overview Lists filtered records. Summary This endpoint will return a set of records filtered by an expression. The filter can be applied to multiple fields and have multiple and/or conditions in it. Alternatively, you may use an existing filter by specifying its id. If both a filter definition and a filter id are passed, the two filters will be joined with an AND . Care will need to be taken to make sure that any filters used have appropriate indexes on the server side otherwise the runtime of the endpoint will be very long. Related fields can be searched by specifying the field name as: "link_name.remote_field", so if you wished to search the Accounts module by a related member account you would use "members.sic_code". Request Arguments Name Type Description filter String The filter expression. Filter expressions are explained below. Note that JSON-encoded filters can be specified as query parameters in one of two ways for GET requests: 1. By specifying individual filter arguments as distinct parameters. Example: filter[0][id]=1 2. By specifying the whole filter as a single JSON-encoded string. Note that this syntax is currently not supported on certain modules. Example: filter=[{"id":"1"}] filter_id String Identifier for a preexisting filter. If filter is also set, the two filters are joined with an AND Name Type Description max_num Integer A maximum number of records to return. Default is 20. offset Integer The number of records to skip over before records are returned. Default is 0. fields String Comma delimited list of fields to return. Each field may be represented either by string, or by map containing field name and additional field parameters (applicable to link and collection fields). The fields id and date_modified will always be returned. Example: name,account_type,description,{"name":"opportunities","fields":["id","name","sales_status"],"order_by":"date_closed:desc"} For more details on additional field parameters, see Relate API and Collection API. view String Instead of defining the fields argument, the view argument can be used instead. The field list is constructed at the server side based on the view definition which is requested. This argument can be used in combination with the fields argument. Common views are "record" and "list". Example: record order_by String How to sort the returned records, in a comma delimited list with the direction appended to the column name after a colon. Example: name:DESC,account_type:DESC,date_modified:ASC q String A search expression, will search on this module. Cannot be used at the same time as a filter expression or id. deleted Boolean Boolean to show deleted records in the result set. nulls_last Boolean Boolean to return records with null values in order_by fields last in the result set. Filter Expressions There are four types of filters: Basic This will filter the results by checking the field "name" for value "Nelson Inc". This will only find exact matches. Example { "filter":[ { "name":"Nelson Inc" } ] } Full This expression allows you to specify what operation you want to use for filtering on the field. In the example you would match any record where the field "name" starts with the value "Nelson". Example { "filter":[ { "name":{ "$starts":"Nelson" } } ] } Below is a list of operation types: Operation Description $equals Performs an exact match on that field. $not_equals Performs an exact match on that field. $not_equals Matches on non-matching values. $starts Matches on anything that starts with the value. $ends Matches anything that ends with the value. Operation Description $contains Matches anything that contains the value $in Finds anything where field matches one of the values as specified as an array. $not_in Finds anything where field does not matches any of the values as specified as an array. $is_null Checks if the field is null. This operation does not need a value specified. $not_null Checks if the field is not null. This operation does not need a value specified. $lt Matches when the field is less than the value. $lte Matches when the field is less than or equal to the value. $gt Matches when the field is greater than the value. $gte Matches when the field is greater than or equal to the value. Sub-expressions This allows you to group filter expressions into or/and groupings. By default all expressions are and'ed together. The example expression would match if the field "name" was either "Nelson Inc" or "Nelson LLC". The only currently accepted sub-expression types are "$and" and "$or". Example { "filter":[ { "$or":[ { "name":"Nelson Inc" }, { "name":"Nelson LLC" } ] } ] } Modules There are two module expressions, they operate on modules instead of fields. The current module can be specified by either using the module name "_this" or by leaving the module name as a blank string. The example expression would filter the records in the current module to only your favorites. The only currently accepted module expressions are "$favorite" and "$owner". Example { "filter":[ { "$favorite":"_this" } ] } Response Arguments ./include/api/help/module_filter_get_help.html Name Type Description Name Type Description next_offset Integer Displays the next offset for retrieval of additional results. -1 will be returned when there are no more records. records Array An array of results containing matched records. Response "name":"Florence Haddock", "date_modified":"2013-02-26T19:12:00+00:00", "description":"", "opportunities": [ { _module: "Opportunities" date_modified: "2014-09-08T16:05:00+03:00" id: "9ce7c088-8ee4-7cd3-18f1-540da944d4c0" name: "360 Vacations - 312 Units" sales_status: "New" }, ], "_acl": { "fields": { } } } ] } Change Log Version Change v10 Added /<module>/filter GET endpoint. POST /<module> createRecord This method creates a new record of the specified type None 6.75 DELETE /<module>/:lhs_sync_key_field_value/link_by_sync_keys/:link_name/:rhs_sync_key_field_value unrelateByFields Remove a relationship based on both sync_keys. If both the LHS and RHS records can be found with the respective sync_key, and those records are related, then remove the relationship of the RHS record to the LHS record. None 10.25 POST /<module>/:lhs_sync_key_field_value/link_by_sync_keys/:link_name/:rhs_sync_key_field_value relateByFields Create a relationship based on both sync_keys. If both the LHS and RHS records can be found with the respective sync_key, then relate the RHS record to the LHS record. None 10.25 GET /<module>/:record retrieveRecord ./modules/pmse_Project/clients/base/api/PMSEFilterOutboundEmailsApi.php Returns a single record None 7.50 DELETE /<module>/:record deleteRecord This method deletes a record of the specified type None 7.50 PUT /<module>/:record updateRecord This method updates a record of the specified type None 7.50 GET /<module>/:record/audit viewChangeLog View audit log in record view None 8.75 GET /<module>/:record/children children This method returns children categories for selected record None 8.75 GET /<module>/:record/collection/:collection_name getCollection Lists collection records. None 9.50 GET /<module>/:record/collection/:collection_name/count getCollectionCount Counts collection records. None 11.25 PUT /<module>/:record/favorite setFavorite This method sets a record of the specified type as a favorite None 9.25 DELETE /<module>/:record/favorite unsetFavorite This method unsets a record of the specified type as a favorite None 8.75 GET /<module>/:record/file getFileList Gets a listing of files related to a field for a module record. None 8.75 POST /<module>/:record/file/:field saveFilePost Saves a file. The file can be a new file or a file override. None 9.50 GET /<module>/:record/file/:field getFile Gets the contents of a single file related to a field for a module record. None 9.50 PUT /<module>/:record/file/:field saveFilePut Saves a file. The file can be a new file or a file override. (This is an alias of the POST method save.) None 9.50 DELETE /<module>/:record/file/:field removeFile Removes a file from a field. None 9.50 POST /<module>/:record/link createRelatedLinks Relates existing records to this module. None 8.75 POST /<module>/:record/link/:link_name createRelatedRecord Create a single record and relate it to this module None 9.50 GET /<module>/:record/link/:link_name filterRelated Lists related records. None 9.50 Overview Lists related filtered records. Summary This endpoint will return a set of related records filtered by an expression. The filter can be applied to multiple fields and have multiple and/or conditions in it. Care will need to be taken to make sure this filter has appropriate indexes on the server side otherwise the runtime of the endpoint will be very long. Related fields can be searched by specifying the field name as: "link_name.remote_field", so if you wished to search the Accounts module by a related member account you would use "members.sic_code". Request Arguments Name Type Description Required filter String The filter expression. Filter expressions are explained below. False max_num Integer A maximum number of records to return. Default is 20. False offset Integer The number of records to skip over before records are returned. Default is 0. False fields String Comma delimited list of fields to return. The field date_modified will always be returned. This argument can be combined with the view argument. Example: name,account_type,description False view String Instead of defining the fields argument, the view argument can be used instead. The field list is constructed at the server side based on the view definition which is requested. This argument can be used in combination with the fields argument. Common views are "record" and "list". Example: record False order_by String How to sort the returned records, in a comma delimited list with the direction appended to the column name after a colon. Example: name:DESC,account_type:DESC,date_modified:ASC False Filter Expressions There are four types of filters: Basic This will filter the results by checking the field "name" for value "Nelson Inc". This will only find exact matches. Example { "filter":[ { "name":"Nelson Inc" } ] } Full This expression allows you to specify what operation you want to use for filtering on the field. In the example you would match any record where the field "name" starts with the value "Nelson". Example { "filter":[ { "name":{ "$starts":"Nelson" } } ] } Below is a list of operation types: Operation Description $equals Performs an exact match on that field. $not_equals Performs an exact match on that field. $not_equals Matches on non-matching values. $starts Matches on anything that starts with the value. $ends Matches anything that ends with the value. Operation Description $contains Matches anything that contains the value $in Finds anything where field matches one of the values as specified as an array. $not_in Finds anything where field does not matches any of the values as specified as an array. $is_null Checks if the field is null. This operation does not need a value specified. $not_null Checks if the field is not null. This operation does not need a value specified. $lt Matches when the field is less than the value. $lte Matches when the field is less than or equal to the value. $gt Matches when the field is greater than the value. $gte Matches when the field is greater than or equal to the value. Sub-expressions This allows you to group filter expressions into or/and groupings. By default all expressions are and'ed together. The example expression would match if the field "name" was either "Nelson Inc" or "Nelson LLC". The only currently accepted sub-expression types are "$and" and "$or". Example { "filter":[ { "$or":[ { "name":"Nelson Inc" }, { "name":"Nelson LLC" } ] } ] } Modules There are two module expressions, they operate on modules instead of fields. The current module can be specified by either using the module name "_this" or by leaving the module name as a blank string. The example expression would filter the records in the current module to only your favorites. The only currently accepted module expressions are "$favorite" and "$owner". Example { "filter":[ { "$favorite":"_this" } ] } Response Arguments ./include/api/help/module_record_link_link_name_filter_get_help.html Name Type Description Name Type Description next_offset Integer Displays the next offset for retrieval of additional results. -1 will be returned when there are no more records. records Array An array of results containing matched records. Repsonse { "next_offset":-1, "records":[ { "id":"fa300a0e-0ad1-b322-9601-512d0983c19a", "name":"Dale Spivey", "date_entered":"2013-02-26T19:12:00+00:00", "date_modified":"2013-02-28T05:03:00+00:00", "modified_user_id":"1", "modified_by_name":"Administrator", "created_by":"1", "created_by_name":"Administrator", "description":"", "img":"", "deleted":false, "assigned_user_id":"seed_sally_id", "assigned_user_name":"Sally Bronsen", "team_name":[ { "id" "E t" Change Log Version Change v10 Added /<module>/:record/link/:link_name/filter GET endpoint. POST /<module>/:record/link/:link_name/:remote_id createRelatedLink Relates an existing record to this module None 10.75 GET /<module>/:record/link/:link_name/:remote_id getRelatedRecord Fetch a single record related to this module None 10.25 DELETE /<module>/:record/link/:link_name/:remote_id deleteRelatedLink Deletes a relationship between two records None 10.25 PUT /<module>/:record/link/:link_name/:remote_id updateRelatedLink ./clients/base/api/RelateApi.php Updates relationship specific information None 10.25 POST /<module>/:record/link/:link_name/add_record_list/:remote_id createRelatedLinksFromRecordList Relates existing records from a record list to this record. None 12.00 GET /<module>/:record/link/:link_name/count filterRelatedCount Counts all filtered related records. None 11.75 GET /<module>/:record/link/:link_name/filter filterRelated Lists related filtered records. None 11.25