id
stringlengths
14
16
text
stringlengths
33
5.27k
source
stringlengths
105
270
8b5ae57c9392-0
How to Check for Duplicate Records Overview An example in bash script demonstrating how to check for duplicate records using the v11 /<module>/duplicateCheck REST POST endpoint. Duplicate Records Authenticating First, you will need to authenticate to the Sugar API. An example is shown below: curl -X POST -H Cache-Control:no-cache -H "Content-Type: application/json" -d '{ "grant_type":"password", "client_id":"sugar", "client_secret":"", "username":"admin", "password":"password", "platform":"custom_api" }' https://{site_url}/rest/v11/oauth2/token
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Check_for_Duplicate_Records/index.html
8b5ae57c9392-1
More information on authenticating can be found in the How to Authenticate and Log Out example and /oauth2/logout endpoint documentation. Retrieving Duplicates Next, we will need to identify the records that are duplicates using the /<module>/duplicateCheck endpoint. curl -s -X POST -H OAuth-Token:{access_token} -H Cache-Control:no-cache -H "Content-Type: application/json" -d '{ "name":"Test Record" }' https://{site_url}/rest/v11/Accounts/duplicateCheck More information on the duplicate check API can be found in the /<module>/duplicateCheck documentation. Response The data received from the server is shown below: { "next_offset": -1,
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Check_for_Duplicate_Records/index.html
8b5ae57c9392-2
{ "next_offset": -1, "records": [{ "id": "7f6ea7be-60d6-11e6-8885-a0999b033b33", "name": "Test Record", "date_entered": "2016-08-12T14:48:25-07:00", "date_modified": "2016-08-12T14:48:25-07:00", "modified_user_id": "1", "modified_by_name": "Administrator", "modified_user_link": { "full_name": "Administrator", "id": "1", "_acl": { "fields": [], "delete": "no",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Check_for_Duplicate_Records/index.html
8b5ae57c9392-3
"fields": [], "delete": "no", "_hash": "8e11bf9be8f04daddee9d08d44ea891e" } }, "created_by": "1", "created_by_name": "Administrator", "created_by_link": { "full_name": "Administrator", "id": "1", "_acl": { "fields": [], "delete": "no", "_hash": "8e11bf9be8f04daddee9d08d44ea891e" } }, "description": "Test Data 1", "deleted": false, "facebook": "", "twitter": "", "googleplus": "",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Check_for_Duplicate_Records/index.html
8b5ae57c9392-4
"twitter": "", "googleplus": "", "account_type": "", "industry": "", "annual_revenue": "", "phone_fax": "", "billing_address_street": "", "billing_address_street_2": "", "billing_address_street_3": "", "billing_address_street_4": "", "billing_address_city": "", "billing_address_state": "", "billing_address_postalcode": "", "billing_address_country": "", "rating": "", "phone_office": "", "phone_alternate": "", "website": "", "ownership": "",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Check_for_Duplicate_Records/index.html
8b5ae57c9392-5
"website": "", "ownership": "", "employees": "", "ticker_symbol": "", "shipping_address_street": "", "shipping_address_street_2": "", "shipping_address_street_3": "", "shipping_address_street_4": "", "shipping_address_city": "", "shipping_address_state": "", "shipping_address_postalcode": "", "shipping_address_country": "", "parent_id": "", "sic_code": "", "duns_num": "", "parent_name": "", "member_of": { "name": "", "id": "",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Check_for_Duplicate_Records/index.html
8b5ae57c9392-6
"name": "", "id": "", "_acl": { "fields": [], "_hash": "654d337e0e912edaa00dbb0fb3dc3c17" } }, "campaign_id": "", "campaign_name": "", "campaign_accounts": { "name": "", "id": "", "_acl": { "fields": [], "_hash": "654d337e0e912edaa00dbb0fb3dc3c17" } }, "following": true, "my_favorite": false, "tag": [], "assigned_user_id": "1", "assigned_user_name": "Administrator",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Check_for_Duplicate_Records/index.html
8b5ae57c9392-7
"assigned_user_name": "Administrator", "assigned_user_link": { "full_name": "Administrator", "id": "1", "_acl": { "fields": [], "delete": "no", "_hash": "8e11bf9be8f04daddee9d08d44ea891e" } }, "team_count": "", "team_count_link": { "team_count": "", "id": "1", "_acl": { "fields": [], "_hash": "654d337e0e912edaa00dbb0fb3dc3c17" } }, "team_name": [{ "id": "1",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Check_for_Duplicate_Records/index.html
8b5ae57c9392-8
}, "team_name": [{ "id": "1", "name": "Global", "name_2": "", "primary": true }], "email": [], "email1": "", "email2": "", "invalid_email": "", "email_opt_out": "", "email_addresses_non_primary": "", "_acl": { "fields": {} }, "_module": "Accounts", "duplicate_check_rank": 8 }, { "id": "868b4f16-60d6-11e6-bdfc-a0999b033b33", "name": "Test Record",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Check_for_Duplicate_Records/index.html
8b5ae57c9392-9
"name": "Test Record", "date_entered": "2016-08-12T14:48:37-07:00", "date_modified": "2016-08-12T14:48:37-07:00", "modified_user_id": "1", "modified_by_name": "Administrator", "modified_user_link": { "full_name": "Administrator", "id": "1", "_acl": { "fields": [], "delete": "no", "_hash": "8e11bf9be8f04daddee9d08d44ea891e" } }, "created_by": "1", "created_by_name": "Administrator", "created_by_link": {
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Check_for_Duplicate_Records/index.html
8b5ae57c9392-10
"created_by_link": { "full_name": "Administrator", "id": "1", "_acl": { "fields": [], "delete": "no", "_hash": "8e11bf9be8f04daddee9d08d44ea891e" } }, "description": "Test Data 2", "deleted": false, "facebook": "", "twitter": "", "googleplus": "", "account_type": "", "industry": "", "annual_revenue": "", "phone_fax": "", "billing_address_street": "", "billing_address_street_2": "",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Check_for_Duplicate_Records/index.html
8b5ae57c9392-11
"billing_address_street_2": "", "billing_address_street_3": "", "billing_address_street_4": "", "billing_address_city": "", "billing_address_state": "", "billing_address_postalcode": "", "billing_address_country": "", "rating": "", "phone_office": "", "phone_alternate": "", "website": "", "ownership": "", "employees": "", "ticker_symbol": "", "shipping_address_street": "", "shipping_address_street_2": "", "shipping_address_street_3": "",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Check_for_Duplicate_Records/index.html
8b5ae57c9392-12
"shipping_address_street_3": "", "shipping_address_street_4": "", "shipping_address_city": "", "shipping_address_state": "", "shipping_address_postalcode": "", "shipping_address_country": "", "parent_id": "", "sic_code": "", "duns_num": "", "parent_name": "", "member_of": { "name": "", "id": "", "_acl": { "fields": [], "_hash": "654d337e0e912edaa00dbb0fb3dc3c17" } }, "campaign_id": "",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Check_for_Duplicate_Records/index.html
8b5ae57c9392-13
} }, "campaign_id": "", "campaign_name": "", "campaign_accounts": { "name": "", "id": "", "_acl": { "fields": [], "_hash": "654d337e0e912edaa00dbb0fb3dc3c17" } }, "following": true, "my_favorite": false, "tag": [], "assigned_user_id": "1", "assigned_user_name": "Administrator", "assigned_user_link": { "full_name": "Administrator", "id": "1", "_acl": { "fields": [], "delete": "no",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Check_for_Duplicate_Records/index.html
8b5ae57c9392-14
"fields": [], "delete": "no", "_hash": "8e11bf9be8f04daddee9d08d44ea891e" } }, "team_count": "", "team_count_link": { "team_count": "", "id": "1", "_acl": { "fields": [], "_hash": "654d337e0e912edaa00dbb0fb3dc3c17" } }, "team_name": [{ "id": "1", "name": "Global", "name_2": "", "primary": true }], "email": [], "email1": "", "email2": "",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Check_for_Duplicate_Records/index.html
8b5ae57c9392-15
"email1": "", "email2": "", "invalid_email": "", "email_opt_out": "", "email_addresses_non_primary": "", "_acl": { "fields": {} }, "_module": "Accounts", "duplicate_check_rank": 8 }] } Last modified: 2023-02-03 21:09:36
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Check_for_Duplicate_Records/index.html
b47e22a5468c-0
How to Favorite a Record Overview An example in bash script demonstrating how to favorite a record using the v11 <module>/:record/favorite REST PUT API endpoint. Favoriting a Record Authenticating First, you will need to authenticate to the Sugar API. An example is shown below: curl -X POST -H Cache-Control:no-cache -H "Content-Type: application/json" -d '{ "grant_type":"password", "client_id":"sugar", "client_secret":"", "username":"admin", "password":"password", "platform":"custom_api" }' https://{site_url}/rest/v11/oauth2/token More information on authenticating can be found in the How to Authenticate and Log Out example and /oauth2/logout endpoint documentation.
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Favorite_a_Record/index.html
b47e22a5468c-1
Favoriting a Record Next, we can favorite a specific record using the /<module>/:record/favorite endpoint. curl -s -X PUT -H OAuth-Token:{access_token} -H Cache-Control:no-cache https://{site_url}/rest/v11/Accounts/ae8b1783-404a-fcb8-1e1e-56f1cc52cd1a/favorite More information on the unfavorite API can be found in the /<module>/:record/favorite PUT documentation. Response The data received from the server is shown below: { "id": "ae8b1783-404a-fcb8-1e1e-56f1cc52cd1a", "name": "Union Bank",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Favorite_a_Record/index.html
b47e22a5468c-2
"name": "Union Bank", "date_entered": "2016-03-22T17:49:50-05:00", "date_modified": "2016-03-30T17:44:20-05:00", "modified_user_id": "1", "modified_by_name": "Administrator", "modified_user_link": { "full_name": "Administrator", "id": "1", "_acl": { "fields": [], "delete": "no", "_hash": "8e11bf9be8f04daddee9d08d44ea891e" } }, "created_by": "1", "created_by_name": "Administrator", "created_by_link": {
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Favorite_a_Record/index.html
b47e22a5468c-3
"created_by_link": { "full_name": "Administrator", "id": "1", "_acl": { "fields": [], "delete": "no", "_hash": "8e11bf9be8f04daddee9d08d44ea891e" } }, "description": "", "deleted": false, "facebook": "", "twitter": "", "googleplus": "", "account_type": "Customer", "industry": "Banking", "annual_revenue": "", "phone_fax": "", "billing_address_street": "67321 West Siam St.", "billing_address_street_2": "",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Favorite_a_Record/index.html
b47e22a5468c-4
"billing_address_street_2": "", "billing_address_street_3": "", "billing_address_street_4": "", "billing_address_city": "Ohio", "billing_address_state": "CA", "billing_address_postalcode": "25159", "billing_address_country": "USA", "rating": "", "phone_office": "(065) 489-6104", "phone_alternate": "", "website": "www.qahr.edu", "ownership": "", "employees": "", "ticker_symbol": "", "shipping_address_street": "67321 West Siam St.",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Favorite_a_Record/index.html
b47e22a5468c-5
"shipping_address_street": "67321 West Siam St.", "shipping_address_street_2": "", "shipping_address_street_3": "", "shipping_address_street_4": "", "shipping_address_city": "Ohio", "shipping_address_state": "CA", "shipping_address_postalcode": "25159", "shipping_address_country": "USA", "parent_id": "", "sic_code": "", "duns_num": "", "parent_name": "", "member_of": { "name": "", "id": "", "_acl": { "fields": [],
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Favorite_a_Record/index.html
b47e22a5468c-6
"id": "", "_acl": { "fields": [], "_hash": "654d337e0e912edaa00dbb0fb3dc3c17" } }, "campaign_id": "", "campaign_name": "", "campaign_accounts": { "name": "", "id": "", "_acl": { "fields": [], "_hash": "654d337e0e912edaa00dbb0fb3dc3c17" } }, "following": true, "my_favorite": true, "tag": [], "assigned_user_id": "seed_sarah_id", "assigned_user_name": "Sarah Smith",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Favorite_a_Record/index.html
b47e22a5468c-7
"assigned_user_name": "Sarah Smith", "assigned_user_link": { "full_name": "Sarah Smith", "id": "seed_sarah_id", "_acl": { "fields": [], "_hash": "654d337e0e912edaa00dbb0fb3dc3c17" } }, "team_count": "", "team_count_link": { "team_count": "", "id": "West", "_acl": { "fields": [], "_hash": "654d337e0e912edaa00dbb0fb3dc3c17" } }, "team_name": [{ "id": "East",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Favorite_a_Record/index.html
b47e22a5468c-8
}, "team_name": [{ "id": "East", "name": "East", "name_2": "", "primary": false }, { "id": 1, "name": "Global", "name_2": "", "primary": false }, { "id": "West", "name": "West", "name_2": "", "primary": true }], "email": [{ "email_address": "[email protected]", "invalid_email": false, "opt_out": false, "primary_address": true, "reply_to_address": false }, {
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Favorite_a_Record/index.html
b47e22a5468c-9
"reply_to_address": false }, { "email_address": "[email protected]", "invalid_email": false, "opt_out": false, "primary_address": false, "reply_to_address": false }], "email1": "[email protected]", "email2": "[email protected]", "invalid_email": false, "email_opt_out": false, "email_addresses_non_primary": "", "_acl": { "fields": {} }, "_module": "Accounts" } Last modified: 2023-02-03 21:04:03
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Favorite_a_Record/index.html
fc27e2a6451c-0
How to Filter a List of Records Overview An example in bash script demonstrating how to filter records using the v11 /<module>/filter REST POST endpoints. Filtering Records Authenticating First, you will need to authenticate to the Sugar API. An example is shown below: curl -X POST -H Cache-Control:no-cache -H "Content-Type: application/json" -d '{ "grant_type":"password", "client_id":"sugar", "client_secret":"", "username":"admin", "password":"password", "platform":"custom_api" }' https://{site_url}/rest/v11/oauth2/token More information on authenticating can be found in the How to Authenticate and Log Out example and /oauth2/logout endpoint documentation.
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Filter_a_List_of_Records/index.html
fc27e2a6451c-1
Filtering Records Next we can filter the records we want to return using the /<module>/filter endpoint with a POST request. curl -s -X POST -H OAuth-Token:{access_token} -H "Content-Type: application/json" -H Cache-Control:no-cache -d '{ "filter":[ { "$or":[ { "name":{ "$starts":"A" } }, { "name":{ "$starts":"b" } } ] } ], "max_num":2, "offset":0, "fields":"id", "order_by":"date_entered",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Filter_a_List_of_Records/index.html
fc27e2a6451c-2
"fields":"id", "order_by":"date_entered", "favorites":false, "my_items":false }' https://{site_url}/rest/v11/Accounts/filter More information on the filter API can be found in the /<module>/filter documentation. Note : The /<module>/filter endpoint can be called using a GET request as well, though long URL requests can have issues so the POST request is recommended.  Response The data received from the server is shown below: { "next_offset":2, "records":[ { "id":"f16760a4-3a52-f77d-1522-5703ca28925f",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Filter_a_List_of_Records/index.html
fc27e2a6451c-3
"date_modified":"2016-04-05T10:23:28-04:00", "_acl":{ "fields":{ } }, "_module":"Accounts" }, { "id":"ec409fbb-2b22-4f32-7fa1-5703caf78dc3", "date_modified":"2016-04-05T10:23:28-04:00", "_acl":{ "fields":{ } }, "_module":"Accounts" } ] } Last modified: 2023-02-03 21:04:03
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Filter_a_List_of_Records/index.html
149d5433745a-0
How to Unfavorite a Record Overview An example in bash script demonstrating how to unfavorite a record using the v11 /<module>/:record/unfavorite REST PUT endpoint. Unfavoriting a Record Authenticating First, you will need to authenticate to the Sugar API. An example is shown below: curl -X POST -H Cache-Control:no-cache -H "Content-Type: application/json" -d '{ "grant_type":"password", "client_id":"sugar", "client_secret":"", "username":"admin", "password":"password", "platform":"custom_api" }' https://{site_url}/rest/v11/oauth2/token
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Unfavorite_a_Record/index.html
149d5433745a-1
More information on authenticating can be found in the How to Authenticate and Log Out example and /oauth2/logout endpoint documentation. Unfavoriting a Record Next, we can unfavorite a specific record using the /<module>/:record/unfavorite endpoint. curl -s -X PUT -H OAuth-Token:{access_token} -H Cache-Control:no-cache https://{site_url}/rest/v11/Accounts/ae8b1783-404a-fcb8-1e1e-56f1cc52cd1a/unfavorite More information on the unfavorite API can be found in the /<module>/:record/unfavorite PUT documentation. Response The data received from the server is shown below: {
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Unfavorite_a_Record/index.html
149d5433745a-2
Response The data received from the server is shown below: { "id": "ae8b1783-404a-fcb8-1e1e-56f1cc52cd1a", "name": "Union Bank", "date_entered": "2016-03-22T17:49:50-05:00", "date_modified": "2016-03-30T17:44:20-05:00", "modified_user_id": "1", "modified_by_name": "Administrator", "modified_user_link": { "full_name": "Administrator", "id": "1", "_acl": { "fields": [], "delete": "no",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Unfavorite_a_Record/index.html
149d5433745a-3
"fields": [], "delete": "no", "_hash": "8e11bf9be8f04daddee9d08d44ea891e" } }, "created_by": "1", "created_by_name": "Administrator", "created_by_link": { "full_name": "Administrator", "id": "1", "_acl": { "fields": [], "delete": "no", "_hash": "8e11bf9be8f04daddee9d08d44ea891e" } }, "description": "", "deleted": false, "facebook": "", "twitter": "", "googleplus": "",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Unfavorite_a_Record/index.html
149d5433745a-4
"twitter": "", "googleplus": "", "account_type": "Customer", "industry": "Banking", "annual_revenue": "", "phone_fax": "", "billing_address_street": "67321 West Siam St.", "billing_address_street_2": "", "billing_address_street_3": "", "billing_address_street_4": "", "billing_address_city": "Ohio", "billing_address_state": "CA", "billing_address_postalcode": "25159", "billing_address_country": "USA", "rating": "", "phone_office": "(065) 489-6104",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Unfavorite_a_Record/index.html
149d5433745a-5
"phone_office": "(065) 489-6104", "phone_alternate": "", "website": "www.qahr.edu", "ownership": "", "employees": "", "ticker_symbol": "", "shipping_address_street": "67321 West Siam St.", "shipping_address_street_2": "", "shipping_address_street_3": "", "shipping_address_street_4": "", "shipping_address_city": "Ohio", "shipping_address_state": "CA", "shipping_address_postalcode": "25159", "shipping_address_country": "USA", "parent_id": "",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Unfavorite_a_Record/index.html
149d5433745a-6
"parent_id": "", "sic_code": "", "duns_num": "", "parent_name": "", "member_of": { "name": "", "id": "", "_acl": { "fields": [], "_hash": "654d337e0e912edaa00dbb0fb3dc3c17" } }, "campaign_id": "", "campaign_name": "", "campaign_accounts": { "name": "", "id": "", "_acl": { "fields": [], "_hash": "654d337e0e912edaa00dbb0fb3dc3c17" } }, "following": true,
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Unfavorite_a_Record/index.html
149d5433745a-7
} }, "following": true, "my_favorite": false, "tag": [], "assigned_user_id": "seed_sarah_id", "assigned_user_name": "Sarah Smith", "assigned_user_link": { "full_name": "Sarah Smith", "id": "seed_sarah_id", "_acl": { "fields": [], "_hash": "654d337e0e912edaa00dbb0fb3dc3c17" } }, "team_count": "", "team_count_link": { "team_count": "", "id": "West", "_acl": { "fields": [],
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Unfavorite_a_Record/index.html
149d5433745a-8
"_acl": { "fields": [], "_hash": "654d337e0e912edaa00dbb0fb3dc3c17" } }, "team_name": [{ "id": "East", "name": "East", "name_2": "", "primary": false }, { "id": 1, "name": "Global", "name_2": "", "primary": false }, { "id": "West", "name": "West", "name_2": "", "primary": true }], "email": [{ "email_address": "[email protected]", "invalid_email": false,
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Unfavorite_a_Record/index.html
149d5433745a-9
"invalid_email": false, "opt_out": false, "primary_address": true, "reply_to_address": false }, { "email_address": "[email protected]", "invalid_email": false, "opt_out": false, "primary_address": false, "reply_to_address": false }], "email1": "[email protected]", "email2": "[email protected]", "invalid_email": false, "email_opt_out": false, "email_addresses_non_primary": "", "_acl": { "fields": {} }, "_module": "Accounts" }
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Unfavorite_a_Record/index.html
149d5433745a-10
"fields": {} }, "_module": "Accounts" } Last modified: 2023-02-03 21:04:03
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Unfavorite_a_Record/index.html
92cff06912c6-0
How to Follow a Record Overview An example in bash script demonstrating how to follow a record using the v11 /<module>/:record/subscribe REST POST endpoint. Following a Record Authenticating First, you will need to authenticate to the Sugar API. An example is shown below: curl -X POST -H Cache-Control:no-cache -H "Content-Type: application/json" -d '{ "grant_type":"password", "client_id":"sugar", "client_secret":"", "username":"admin", "password":"password", "platform":"custom_api" }' https://{site_url}/rest/v11/oauth2/token
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Follow_a_Record/index.html
92cff06912c6-1
More information on authenticating can be found in the How to Authenticate and Log Out example and /oauth2/logout endpoint documentation. Following a Record Next, we can follow a specific record using the /<module>/:record/subscribe endpoint. curl -s -X POST -H OAuth-Token:{access_token} -H Cache-Control:no-cache https://{site_url}/rest/v11/Accounts/e3a59dcd-ff5e-8a78-cd7f-570811366792/subscribe More information on the subscribe API can be found in the /<module>/:record/subscribe POST documentation. Response The data received from the server is shown below:
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Follow_a_Record/index.html
92cff06912c6-2
Response The data received from the server is shown below: "58f96315-9e75-6562-42e9-5705917d2cdc" Last modified: 2023-02-03 21:04:03
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Follow_a_Record/index.html
78f38acecc2a-0
How to Manipulate Records (CRUD) Overview The following page will provide examples in bash script demonstrating how to use the CRUD (Create, Read, Update, Delete) endpoints in the REST v11 API. CRUD Operations Authenticating First, you will need to authenticate to the Sugar API. An example is shown below: curl -X POST -H Cache-Control:no-cache -H "Content-Type: application/json" -d '{ "grant_type":"password", "client_id":"sugar", "client_secret":"", "username":"admin", "password":"password", "platform":"custom_api" }' https://{site_url}/rest/v11/oauth2/token
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_Records_CRUD/index.html
78f38acecc2a-1
More information on authenticating can be found in the How to Authenticate and Log Out example and /oauth2/logout endpoint documentation. Creating a Record Next, we need to submit the record to the Sugar instance using the /<module> endpoint. In this example, we are going to create an Account record with a Name of 'Test Record' and an email of '[email protected]'. curl -X POST -H OAuth-Token:<access_token> -H Cache-Control:no-cache -H "Content-Type: application/json -d '{ "name":"Test Record", "email1":"[email protected]" }' http://<site_url>/rest/v11/Accounts
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_Records_CRUD/index.html
78f38acecc2a-2
}' http://<site_url>/rest/v11/Accounts More information on this API endpoint can be found in the /<module> - POST documentation. Response The data received from the server is shown below: { "id":"ab2222df-73da-0e92-6887-5705428f4d68", "name":"Test Record", "date_entered":"2016-04-06T13:07:41-04:00", "date_modified":"2016-04-06T13:07:41-04:00", "modified_user_id":"1", "modified_by_name":"Administrator", "modified_user_link":{ "full_name":"Administrator", "id":"1", "_acl":{ "fields":[
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_Records_CRUD/index.html
78f38acecc2a-3
"id":"1", "_acl":{ "fields":[ ], "delete":"no", "_hash":"8e11bf9be8f04daddee9d08d44ea891e" } }, "created_by":"1", "created_by_name":"Administrator", "created_by_link":{ "full_name":"Administrator", "id":"1", "_acl":{ "fields":[ ], "delete":"no", "_hash":"8e11bf9be8f04daddee9d08d44ea891e" } }, "description":"", "deleted":false, "facebook":"", "twitter":"", "googleplus":"",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_Records_CRUD/index.html
78f38acecc2a-4
"facebook":"", "twitter":"", "googleplus":"", "account_type":"", "industry":"", "annual_revenue":"", "phone_fax":"", "billing_address_street":"", "billing_address_street_2":"", "billing_address_street_3":"", "billing_address_street_4":"", "billing_address_city":"", "billing_address_state":"", "billing_address_postalcode":"", "billing_address_country":"", "rating":"", "phone_office":"", "phone_alternate":"", "website":"", "ownership":"", "employees":"",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_Records_CRUD/index.html
78f38acecc2a-5
"ownership":"", "employees":"", "ticker_symbol":"", "shipping_address_street":"", "shipping_address_street_2":"", "shipping_address_street_3":"", "shipping_address_street_4":"", "shipping_address_city":"", "shipping_address_state":"", "shipping_address_postalcode":"", "shipping_address_country":"", "parent_id":"", "sic_code":"", "duns_num":"", "parent_name":"", "member_of":{ "name":"", "id":"", "_acl":{ "fields":[ ],
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_Records_CRUD/index.html
78f38acecc2a-6
"id":"", "_acl":{ "fields":[ ], "_hash":"654d337e0e912edaa00dbb0fb3dc3c17" } }, "campaign_id":"", "campaign_name":"", "campaign_accounts":{ "name":"", "id":"", "_acl":{ "fields":[ ], "_hash":"654d337e0e912edaa00dbb0fb3dc3c17" } }, "following":true, "my_favorite":false, "tag":[ ], "assigned_user_id":"", "assigned_user_name":"", "assigned_user_link":{
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_Records_CRUD/index.html
78f38acecc2a-7
"assigned_user_link":{ "full_name":"", "id":"", "_acl":{ "fields":[ ], "_hash":"654d337e0e912edaa00dbb0fb3dc3c17" } }, "team_count":"", "team_count_link":{ "team_count":"", "id":"1", "_acl":{ "fields":[ ], "_hash":"654d337e0e912edaa00dbb0fb3dc3c17" } }, "team_name":[ { "id":1, "name":"Global", "name_2":"", "primary":true } ], "email":[
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_Records_CRUD/index.html
78f38acecc2a-8
"primary":true } ], "email":[ { "email_address":"[email protected]", "invalid_email":false, "opt_out":false, "primary_address":true, "reply_to_address":false } ], "email1":"[email protected]", "email2":"", "invalid_email":false, "email_opt_out":false, "email_addresses_non_primary":"", "_acl":{ "fields":{ } }, "_module":"Accounts" } Getting a Record
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_Records_CRUD/index.html
78f38acecc2a-9
} }, "_module":"Accounts" } Getting a Record Next we can get the created record from the Sugar instance using the /<module>/:record endpoint. In this example, we are going to get an Account record by it's ID, but only request the Name, Email, and Industry fields. curl -H OAuth-Token:<access_token> -H Cache-Control:no-cache http://<site_url>/rest/v11/Accounts/<record_id>?fields=name,email1,industry More information on this API endpoint can be found in the /<module>/:record - GET documentation. Response The data received from the server is shown below: {
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_Records_CRUD/index.html
78f38acecc2a-10
Response The data received from the server is shown below: { "id":"ab2222df-73da-0e92-6887-5705428f4d68", "name":"Test Record", "date_modified":"2016-04-06T15:03:21-04:00", "industry":"", "email1":"[email protected]", "_acl":{ "fields":{ } }, "_module":"Accounts" } Updating a Record Next we can update  the record in the Sugar instance using the /<module>/:record endpoint, and the PUT Http method. In this example we are going to update the Account record and change it's name to "Updated Test Record".
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_Records_CRUD/index.html
78f38acecc2a-11
curl -X PUT -H OAuth-Token:<access_token> -H Cache-Control:no-cache -d '{ "name":"Updated Record" }' http://<site_url>/rest/v11/Accounts/<record_id> More information on this API endpoint can be found in the /<module>/:record - PUT documentation. Response The data received from the server is shown below: { "id":"ab2222df-73da-0e92-6887-5705428f4d68", "name":"Updated Test Record", "date_entered":"2016-04-06T15:03:21-04:00", "date_modified":"2016-04-06T15:03:22-04:00",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_Records_CRUD/index.html
78f38acecc2a-12
"modified_user_id":"1", "modified_by_name":"Administrator", "modified_user_link":{ "full_name":"Administrator", "id":"1", "_acl":{ "fields":[ ], "delete":"no", "_hash":"8e11bf9be8f04daddee9d08d44ea891e" } }, "created_by":"1", "created_by_name":"Administrator", "created_by_link":{ "full_name":"Administrator", "id":"1", "_acl":{ "fields":[ ], "delete":"no", "_hash":"8e11bf9be8f04daddee9d08d44ea891e"
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_Records_CRUD/index.html
78f38acecc2a-13
} }, "description":"", "deleted":false, "facebook":"", "twitter":"", "googleplus":"", "account_type":"", "industry":"", "annual_revenue":"", "phone_fax":"", "billing_address_street":"", "billing_address_street_2":"", "billing_address_street_3":"", "billing_address_street_4":"", "billing_address_city":"", "billing_address_state":"", "billing_address_postalcode":"", "billing_address_country":"", "rating":"", "phone_office":"", "phone_alternate":"", "website":"",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_Records_CRUD/index.html
78f38acecc2a-14
"phone_alternate":"", "website":"", "ownership":"", "employees":"", "ticker_symbol":"", "shipping_address_street":"", "shipping_address_street_2":"", "shipping_address_street_3":"", "shipping_address_street_4":"", "shipping_address_city":"", "shipping_address_state":"", "shipping_address_postalcode":"", "shipping_address_country":"", "parent_id":"", "sic_code":"", "duns_num":"", "parent_name":"", "member_of":{ "name":"", "id":"", "_acl":{ "fields":[
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_Records_CRUD/index.html
78f38acecc2a-15
"id":"", "_acl":{ "fields":[ ], "_hash":"654d337e0e912edaa00dbb0fb3dc3c17" } }, "campaign_id":"", "campaign_name":"", "campaign_accounts":{ "name":"", "id":"", "_acl":{ "fields":[ ], "_hash":"654d337e0e912edaa00dbb0fb3dc3c17" } }, "following":true, "my_favorite":false, "tag":[ ], "assigned_user_id":"", "assigned_user_name":"", "assigned_user_link":{
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_Records_CRUD/index.html
78f38acecc2a-16
"assigned_user_link":{ "full_name":"", "id":"", "_acl":{ "fields":[ ], "_hash":"654d337e0e912edaa00dbb0fb3dc3c17" } }, "team_count":"", "team_count_link":{ "team_count":"", "id":"1", "_acl":{ "fields":[ ], "_hash":"654d337e0e912edaa00dbb0fb3dc3c17" } }, "team_name":[ { "id":1, "name":"Global", "name_2":"", "primary":true } ], "email":[
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_Records_CRUD/index.html
78f38acecc2a-17
"primary":true } ], "email":[ { "email_address":"[email protected]", "invalid_email":false, "opt_out":false, "primary_address":true, "reply_to_address":false } ], "email1":"[email protected]", "email2":"", "invalid_email":false, "email_opt_out":false, "email_addresses_non_primary":"", "_acl":{ "fields":{ } }, "_module":"Accounts" } Deleting a Record
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_Records_CRUD/index.html
78f38acecc2a-18
}, "_module":"Accounts" } Deleting a Record Next, we can delete the record from the Sugar instance using the /<module>/:record endpoint, by using the DELETE Http Method. curl -X DELETE -H OAuth-Token:<access_token> -H Cache-Control:no-cache http://<site_url>/rest/v11/Accounts/<record_id> More information on this API endpoint can be found in the /<module>/:record - DELETE documentation.  Response The data received from the server is shown below: { "id":"ab2222df-73da-0e92-6887-5705428f4d68" }
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_Records_CRUD/index.html
78f38acecc2a-19
} Last modified: 2023-02-03 21:04:03
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_Records_CRUD/index.html
6dc6f78917d5-0
How to Manipulate File Attachments Overview An example in bash script demonstrating how to attach a file to a record using the v11 <module>/:record/file/:field REST POST API endpoint, then retrieve it with the GET endpoint. Manipulating File Attachments Authenticating First, you will need to authenticate to the Sugar API. An example is shown below: curl -X POST -H Cache-Control:no-cache -H "Content-Type: application/json" -d '{ "grant_type":"password", "client_id":"sugar", "client_secret":"", "username":"admin", "password":"password", "platform":"custom_api" }' https://{site_url}/rest/v11/oauth2/token
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_File_Attachments/index.html
6dc6f78917d5-1
More information on authenticating can be found in the How to Authenticate and Log Out example and /oauth2/logout endpoint documentation. Submitting a File Attachment Next, we can create a Note record using the /<module endpoint, and then submit a File to the Note record using the /<module>/:record/file/:field endpoint. Create Note curl -s -X POST -H OAuth-Token:{access_token}-H "Content-Type: application/json" -H Cache-Control:no-cache -d '{ "name":"Test Note" }' https://{site_url}/rest/v11/Notes Add An Attachment to the Note
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_File_Attachments/index.html
6dc6f78917d5-2
Add An Attachment to the Note curl -X POST -H OAuth-Token:{access_token} -H Cache-Control:no-cache -F "filename=@/path/to/file.txt" https://{site_url}/rest/v11/Notes/7b49aebd-8734-9773-8ef1-53553fa369c7/file/filename Response { "filename":{ "content-type":"text\/plain", "content-length":13, "name":"file.txt", "uri":"http:\/\/<site url>\/rest\/v11\/Notes\/7b49aebd-8734-9773-8ef1-53553fa369c7\/file\/filename" }, "record":{ "my_favorite":false,
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_File_Attachments/index.html
6dc6f78917d5-3
}, "record":{ "my_favorite":false, "following":true, "id":"7b49aebd-8734-9773-8ef1-53553fa369c7", "name":"My Note", "date_modified":"2014-04-21T11:53:53-04:00", "modified_user_id":"1", "modified_by_name":"admin", "created_by":"1", "created_by_name":"Administrator", "doc_owner":"", "user_favorites":[ ], "description":"", "deleted":false, "assigned_user_id":"", "assigned_user_name":"", "team_count":"", "team_name":[
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_File_Attachments/index.html
6dc6f78917d5-4
"team_count":"", "team_name":[ { "id":1, "name":"Global", "name_2":"", "primary":true } ], "file_mime_type":"text\/plain", "file_url":"", "filename":"file.txt", "parent_type":"", "parent_id":"", "contact_id":"", "portal_flag":false, "embed_flag":false, "parent_name":"", "contact_name":"", "contact_phone":"", "contact_email":"", "account_id":"", "opportunity_id":"", "acase_id":"", "lead_id":"",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_File_Attachments/index.html
6dc6f78917d5-5
"acase_id":"", "lead_id":"", "product_id":"", "quote_id":"", "_acl":{ "fields":{ } }, "_module":"Notes" } } Getting a File Attachment Next, we can retrieve the file attachment stored in Sugar by utilizing the /<module>/:record/file/:field GET endpoint. curl -i -s -X GET -H OAuth-Token:{access_token} -H Cache-Control:no-cache https://{site_url}/rest/v11/Notes/7b49aebd-8734-9773-8ef1-53553fa369c7/file/filename Response HTTP/1.1 200 OK
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_File_Attachments/index.html
6dc6f78917d5-6
Response HTTP/1.1 200 OK Date: Wed, 12 Mar 2014 15:15:03 GMT Server: Apache/2.2.22 (Unix) PHP/5.3.14 mod_ssl/2.2.22 OpenSSL/0.9.8o X-Powered-By: PHP/5.3.14 ZendServer/5.0 Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/ Expires: Cache-Control: max-age=0, private Pragma: Content-Disposition: attachment; filename="file.txt" X-Content-Type-Options: nosniff ETag: d41d8cd98f00b204e9800998ecf8427e Content-Length: 16 Connection: close Content-Type: application/octet-stream
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_File_Attachments/index.html
6dc6f78917d5-7
Connection: close Content-Type: application/octet-stream This is the file contents. You can also output the results directly to a file by omitting the header data and output the results directly to a new file. curl -s -X GET -H OAuth-Token:{access_token} -H Cache-Control:no-cache https://{site_url}/rest/v11/Notes/7b49aebd-8734-9773-8ef1-53553fa369c7/file/filename > file.txt Last modified: 2023-02-03 21:04:03
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Manipulate_File_Attachments/index.html
af55e9517bf6-0
How to Get the Most Active Users Overview An example in bash script demonstrating how to fetch the most active users for meetings, calls, inbound emails, and outbound emails using the v11 /mostactiveusers REST GET endpoint. Get Most Active Users Authenticating First, you will need to authenticate to the Sugar API. An example is shown below: curl -X POST -H Cache-Control:no-cache -H "Content-Type: application/json" -d '{ "grant_type":"password", "client_id":"sugar", "client_secret":"", "username":"admin", "password":"password", "platform":"custom_api" }' https://{site_url}/rest/v11/oauth2/token
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Get_the_Most_Active_Users/index.html
af55e9517bf6-1
More information on authenticating can be found in the How to Authenticate and Log Out example and /oauth2/logout endpoint documentation. Active Users Next, we can retrieve the most active users using the /mostactiveusers endpoint. curl -s -X GET -H OAuth-Token:{access_token} -H Cache-Control:no-cache https://{site_url}/rest/v11/mostactiveusers?days=30 More information on the mostactiveusers API can be found in the /mostactiveusers documentation.  Response The data received from the server is shown below: { "meetings": { "user_id": "seed_max_id", "count": "21", "first_name": "Max", "last_name": "Jensen"
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Get_the_Most_Active_Users/index.html
af55e9517bf6-2
"last_name": "Jensen" }, "calls": { "user_id": "seed_chris_id", "count": "4", "first_name": "Chris", "last_name": "Olliver" }, "inbound_emails": { "user_id": "seed_chris_id", "count": "23", "first_name": "Chris", "last_name": "Olliver" }, "outbound_emails": { "user_id": "seed_sarah_id", "count": "20", "first_name": "Sarah", "last_name": "Smith" } }
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Get_the_Most_Active_Users/index.html
af55e9517bf6-3
"last_name": "Smith" } } Last modified: 2023-02-03 21:04:03
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Get_the_Most_Active_Users/index.html
4dd4d12fe8ba-0
How to Fetch the Current Users Time Overview An example in bash script demonstrating how to fetch the current users time with the v11 /ping/whattimeisit REST GET endpoint. Authenticating First, you will need to authenticate to the Sugar API. An example is shown below: curl -X POST -H Cache-Control:no-cache -H "Content-Type: application/json" -d '{ "grant_type":"password", "client_id":"sugar", "client_secret":"", "username":"admin", "password":"password", "platform":"custom_api" }' https://{site_url}/rest/v11/oauth2/token More information on authenticating can be found in the How to Authenticate and Log Out example and /oauth2/logout endpoint documentation.
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_the_Current_Users_Time/index.html
4dd4d12fe8ba-1
Getting the Current Time and Date for the User Next, we can get the current time and date using the /ping/whattimeisit endpoint. curl -s -X GET -H OAuth-Token:{access_token} -H Cache-Control:no-cache https://{site_url}/rest/v11/ping/whattimeisit Response "2017-11-03T06:45:59-07:00" Last modified: 2023-02-03 21:04:03
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_the_Current_Users_Time/index.html
206a7be6ad6a-0
How to Fetch Related Records Overview An example in bash script demonstrating how to fetch related records using the v11 /<module>/:record/link/:link REST GET endpoints. Fetching Related Records Authenticating First, you will need to authenticate to the Sugar API. An example is shown below: curl -X POST -H Cache-Control:no-cache -H "Content-Type: application/json" -d '{ "grant_type":"password", "client_id":"sugar", "client_secret":"", "username":"admin", "password":"password", "platform":"custom_api" }' https://{site_url}/rest/v11/oauth2/token
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_Related_Records/index.html
206a7be6ad6a-1
More information on authenticating can be found in the How to Authenticate and Log Out example and /oauth2/logout endpoint documentation. Fetching Related Records Next, we can fetch the related records we want to return using the /<module>/:record/link/:link endpoint with a GET request where Element Meaning <module> The parent module name :record The parent records ID link the actual word "link" :link The name of the relationship to fetch  In this example we will fetch the related Contacts for an Account :
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_Related_Records/index.html
206a7be6ad6a-2
In this example we will fetch the related Contacts for an Account : curl -s -X GET -H OAuth-Token:{access_token} -H Cache-Control:no-cache https://{site_url}/rest/v11/Accounts/e8c641ca-1b8c-74c1-d08d-56fedbdd3187/link/contacts Response The data received from the server is shown below: { "next_offset":-1, "records":[ { "my_favorite":false, "following":false, "id":"819f4149-b007-a6da-a5fa-56fedbf2de77", "name":"Florine Marcus",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_Related_Records/index.html
206a7be6ad6a-3
"name":"Florine Marcus", "date_entered":"2016-04-01T15:34:00-05:00", "date_modified":"2016-04-01T15:34:00-05:00", "modified_user_id":"1", "modified_by_name":"Administrator", "created_by":"1", "created_by_name":"Administrator", "doc_owner":"", "user_favorites":"", "description":"", "deleted":false, "assigned_user_id":"seed_will_id", "assigned_user_name":"Will Westin", "team_count":"", "team_name":[ { "id":"East", "name":"East",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_Related_Records/index.html
206a7be6ad6a-4
{ "id":"East", "name":"East", "name_2":"", "primary":true }, { "id":"West", "name":"West", "name_2":"", "primary":false } ], "email":[ { "email_address":"[email protected]", "primary_address":true, "reply_to_address":false, "invalid_email":false, "opt_out":false }, { "email_address":"[email protected]", "primary_address":false, "reply_to_address":false, "invalid_email":false, "opt_out":true } ],
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_Related_Records/index.html
206a7be6ad6a-5
"opt_out":true } ], "email1":"[email protected]", "email2":"", "invalid_email":false, "email_opt_out":false, "email_addresses_non_primary":"", "salutation":"", "first_name":"Florine", "last_name":"Marcus", "full_name":"Florine Marcus", "title":"President", "facebook":"", "twitter":"", "googleplus":"", "department":"", "do_not_call":false, "phone_home":"(746) 162-2314", "phone_mobile":"(941) 088-2874", "phone_work":"(827) 541-9614",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_Related_Records/index.html
206a7be6ad6a-6
"phone_work":"(827) 541-9614", "phone_other":"", "phone_fax":"", "primary_address_street":"1715 Scott Dr", "primary_address_street_2":"", "primary_address_street_3":"", "primary_address_city":"Alabama", "primary_address_state":"NY", "primary_address_postalcode":"70187", "primary_address_country":"USA", "alt_address_street":"", "alt_address_street_2":"", "alt_address_street_3":"", "alt_address_city":"", "alt_address_state":"", "alt_address_postalcode":"", "alt_address_country":"",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_Related_Records/index.html
206a7be6ad6a-7
"alt_address_country":"", "assistant":"", "assistant_phone":"", "picture":"", "email_and_name1":"", "lead_source":"Employee", "account_name":"MTM Investment Bank F S B", "account_id":"e8c641ca-1b8c-74c1-d08d-56fedbdd3187", "dnb_principal_id":"", "opportunity_role_fields":"", "opportunity_role_id":"", "opportunity_role":"", "reports_to_id":"", "report_to_name":"", "birthdate":"", "portal_name":"FlorineMarcus119", "portal_active":true,
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_Related_Records/index.html
206a7be6ad6a-8
"portal_active":true, "portal_password":true, "portal_password1":null, "portal_app":"", "preferred_language":"en_us", "campaign_id":"", "campaign_name":"", "c_accept_status_fields":"", "m_accept_status_fields":"", "accept_status_id":"", "accept_status_name":"", "accept_status_calls":"", "accept_status_meetings":"", "sync_contact":false, "mkto_sync":false, "mkto_id":null, "mkto_lead_score":null, "_acl":{ "fields":{ } },
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_Related_Records/index.html
206a7be6ad6a-9
"_acl":{ "fields":{ } }, "_module":"Contacts" }, { "my_favorite":false, "following":false, "id":"527cc1a9-7984-91fe-4148-56fedbc356aa", "name":"Shaneka Aceto", "date_entered":"2016-04-01T15:34:00-05:00", "date_modified":"2016-04-01T15:34:00-05:00", "modified_user_id":"1", "modified_by_name":"Administrator", "created_by":"1", "created_by_name":"Administrator", "doc_owner":"", "user_favorites":"",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_Related_Records/index.html
206a7be6ad6a-10
"doc_owner":"", "user_favorites":"", "description":"", "deleted":false, "assigned_user_id":"seed_will_id", "assigned_user_name":"Will Westin", "team_count":"", "team_name":[ { "id":"East", "name":"East", "name_2":"", "primary":true }, { "id":"West", "name":"West", "name_2":"", "primary":false } ], "email":[ { "email_address":"[email protected]", "primary_address":true, "reply_to_address":false, "invalid_email":false,
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_Related_Records/index.html
206a7be6ad6a-11
"invalid_email":false, "opt_out":false }, { "email_address":"[email protected]", "primary_address":false, "reply_to_address":false, "invalid_email":false, "opt_out":true } ], "email1":"[email protected]", "email2":"", "invalid_email":false, "email_opt_out":false, "email_addresses_non_primary":"", "salutation":"", "first_name":"Shaneka", "last_name":"Aceto", "full_name":"Shaneka Aceto", "title":"IT Developer", "facebook":"",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_Related_Records/index.html
206a7be6ad6a-12
"title":"IT Developer", "facebook":"", "twitter":"", "googleplus":"", "department":"", "do_not_call":false, "phone_home":"(502) 528-5151", "phone_mobile":"(816) 719-3739", "phone_work":"(994) 769-5855", "phone_other":"", "phone_fax":"", "primary_address_street":"123 Anywhere Street", "primary_address_street_2":"", "primary_address_street_3":"", "primary_address_city":"Denver", "primary_address_state":"NY", "primary_address_postalcode":"15128", "primary_address_country":"USA",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_Related_Records/index.html
206a7be6ad6a-13
"primary_address_country":"USA", "alt_address_street":"", "alt_address_street_2":"", "alt_address_street_3":"", "alt_address_city":"", "alt_address_state":"", "alt_address_postalcode":"", "alt_address_country":"", "assistant":"", "assistant_phone":"", "picture":"", "email_and_name1":"", "lead_source":"Email", "account_name":"MTM Investment Bank F S B", "account_id":"e8c641ca-1b8c-74c1-d08d-56fedbdd3187", "dnb_principal_id":"",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_Related_Records/index.html
206a7be6ad6a-14
"dnb_principal_id":"", "opportunity_role_fields":"", "opportunity_role_id":"", "opportunity_role":"", "reports_to_id":"", "report_to_name":"", "birthdate":"", "portal_name":"ShanekaAceto151", "portal_active":true, "portal_password":true, "portal_password1":null, "portal_app":"", "preferred_language":"en_us", "campaign_id":"", "campaign_name":"", "c_accept_status_fields":"", "m_accept_status_fields":"", "accept_status_id":"",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_Related_Records/index.html
206a7be6ad6a-15
"accept_status_id":"", "accept_status_name":"", "accept_status_calls":"", "accept_status_meetings":"", "sync_contact":false, "mkto_sync":false, "mkto_id":null, "mkto_lead_score":null, "_acl":{ "fields":{ } }, "_module":"Contacts" }, { "my_favorite":false, "following":false, "id":"42d703ed-f834-f87c-967d-56fedb044051", "name":"Johnnie Pina", "date_entered":"2016-04-01T15:34:00-05:00",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_Related_Records/index.html
206a7be6ad6a-16
"date_modified":"2016-04-01T15:34:00-05:00", "modified_user_id":"1", "modified_by_name":"Administrator", "created_by":"1", "created_by_name":"Administrator", "doc_owner":"", "user_favorites":"", "description":"", "deleted":false, "assigned_user_id":"seed_will_id", "assigned_user_name":"Will Westin", "team_count":"", "team_name":[ { "id":"East", "name":"East", "name_2":"", "primary":true }, { "id":"West", "name":"West",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_Related_Records/index.html
206a7be6ad6a-17
}, { "id":"West", "name":"West", "name_2":"", "primary":false } ], "email":[ { "email_address":"[email protected]", "primary_address":true, "reply_to_address":false, "invalid_email":false, "opt_out":false }, { "email_address":"[email protected]", "primary_address":false, "reply_to_address":false, "invalid_email":false, "opt_out":true } ], "email1":"[email protected]", "email2":"",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_Related_Records/index.html
206a7be6ad6a-18
"email2":"", "invalid_email":false, "email_opt_out":false, "email_addresses_non_primary":"", "salutation":"", "first_name":"Johnnie", "last_name":"Pina", "full_name":"Johnnie Pina", "title":"VP Operations", "facebook":"", "twitter":"", "googleplus":"", "department":"", "do_not_call":false, "phone_home":"(159) 335-1423", "phone_mobile":"(580) 140-4050", "phone_work":"(418) 792-9611", "phone_other":"", "phone_fax":"", "primary_address_street":"345 Sugar Blvd.",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_Related_Records/index.html
206a7be6ad6a-19
"primary_address_street":"345 Sugar Blvd.", "primary_address_street_2":"", "primary_address_street_3":"", "primary_address_city":"Denver", "primary_address_state":"NY", "primary_address_postalcode":"70648", "primary_address_country":"USA", "alt_address_street":"", "alt_address_street_2":"", "alt_address_street_3":"", "alt_address_city":"", "alt_address_state":"", "alt_address_postalcode":"", "alt_address_country":"", "assistant":"", "assistant_phone":"", "picture":"", "email_and_name1":"",
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_Related_Records/index.html
206a7be6ad6a-20
"picture":"", "email_and_name1":"", "lead_source":"Direct Mail", "account_name":"MTM Investment Bank F S B", "account_id":"e8c641ca-1b8c-74c1-d08d-56fedbdd3187", "dnb_principal_id":"", "opportunity_role_fields":"", "opportunity_role_id":"", "opportunity_role":"", "reports_to_id":"", "report_to_name":"", "birthdate":"", "portal_name":"JohnniePina194", "portal_active":true, "portal_password":true, "portal_password1":null,
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_Related_Records/index.html
206a7be6ad6a-21
"portal_password1":null, "portal_app":"", "preferred_language":"en_us", "campaign_id":"", "campaign_name":"", "c_accept_status_fields":"", "m_accept_status_fields":"", "accept_status_id":"", "accept_status_name":"", "accept_status_calls":"", "accept_status_meetings":"", "sync_contact":false, "mkto_sync":false, "mkto_id":null, "mkto_lead_score":null, "_acl":{ "fields":{ } }, "_module":"Contacts" } ] }
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Cookbook/Web_Services/REST_API/Bash/How_to_Fetch_Related_Records/index.html