This repository has been archived by the owner on Oct 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Read Module By Id
mattkol edited this page Dec 18, 2016
·
6 revisions
This sample usage shows how to read "Leads" module data by Id. For more request options make changes to the [Options parameter](Request Options).
This implements the get_entry SugarCRM REST API method.
using SugarRestSharp;
string url = "http://191.101.224.189/sugar/service/v4_1/rest.php";
string username = "will";
string password = "will";
string moduleName = "Leads";
string moduleId = "10d82d59-08eb-8f0d-28e0-5777b57af47c";
var client = new SugarRestClient(url, username, password);
var request = new SugarRestRequest(moduleName, RequestType.ReadById);
request.Parameter = moduleId;
SugarRestResponse response = client.Execute(request);
Lead lead = (Lead)response.Data;
{
"assigned_user_name": "Max Jensen",
"modified_by_name": "Administrator",
"created_by_name": "Administrator",
"id": "10d82d59-08eb-8f0d-28e0-5777b57af47c",
"name": "Howard Fricks",
"date_entered": "2016-07-02 12:36:44",
"date_modified": "2016-07-02 12:36:44",
"modified_user_id": "1",
"created_by": "1",
"description": "",
"deleted": "0",
"assigned_user_id": "seed_max_id",
"salutation": "",
"first_name": "Howard",
"last_name": "Fricks",
"full_name": "Howard Fricks",
"title": "Director Sales",
"department": "",
"do_not_call": "0",
"phone_home": "(023) 107-6052",
"email": "",
"phone_mobile": "(058) 861-7434",
"phone_work": "(912) 507-8175",
"phone_other": "",
"phone_fax": "",
"email1": "sales.kid.phone@example.info",
"email2": "",
"invalid_email": "0",
"email_opt_out": "0",
"primary_address_street": "1715 Scott Dr",
"primary_address_street_2": "",
"primary_address_street_3": "",
"primary_address_city": "Salt Lake City",
"primary_address_state": "CA",
"primary_address_postalcode": "33515",
"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": "",
"email_addresses_non_primary": "",
"converted": "0",
"refered_by": "",
"lead_source": "Trade Show",
"lead_source_description": "",
"status": "Assigned",
"status_description": "",
"reports_to_id": "",
"report_to_name": "",
"account_name": "Hollywood Diner Ltd",
"account_description": "",
"contact_id": "",
"account_id": "",
"opportunity_id": "",
"opportunity_name": "",
"opportunity_amount": "",
"campaign_id": "",
"campaign_name": "",
"c_accept_status_fields": "",
"m_accept_status_fields": "",
"accept_status_id": "",
"accept_status_name": "",
"webtolead_email1": "",
"webtolead_email2": "",
"webtolead_email_opt_out": "",
"webtolead_invalid_email": "",
"birthdate": "False",
"portal_name": "",
"portal_app": "",
"website": ""
}
{
"resource": "",
"parameters": [
{
"name": "method",
"value": "get_entry",
"type": "GetOrPost"
},
{
"name": "input_type",
"value": "json",
"type": "GetOrPost"
},
{
"name": "response_type",
"value": "json",
"type": "GetOrPost"
},
{
"name": "rest_data",
"value": "{\"session\":\"1j0s9s6m3hpqujef7675v69vi2\",\"module_name\":\"Leads\",\"id\":\"10d82d59-08eb-8f0d-28e0-5777b57af47c\",\"select_fields\":[],\"link_name_to_fields_array\":\"\",\"track_view\":false}",
"type": "GetOrPost"
},
{
"name": "Accept",
"value": "application\/json, application\/xml, text\/json, text\/x-json, text\/javascript, text\/xml",
"type": "HttpHeader"
}
],
"method": "POST",
"uri": "http:\/\/191.101.224.189\/sugar\/service\/v4_1\/rest.php"
}
{
"statusCode": 200,
"content": "{\"entry_list\":[{\"id\":\"10d82d59-08eb-8f0d-28e0-5777b57af47c\",\"module_name\":\"Leads\",\"name_value_list\":{\"assigned_user_name\":{\"name\":\"assigned_user_name\",\"value\":\"Max Jensen\"},\"modified_by_name\":{\"name\":\"modified_by_name\",\"value\":\"Administrator\"},\"created_by_name\":{\"name\":\"created_by_name\",\"value\":\"Administrator\"},\"id\":{\"name\":\"id\",\"value\":\"10d82d59-08eb-8f0d-28e0-5777b57af47c\"},\"name\":{\"name\":\"name\",\"value\":\"Howard Fricks\"},\"date_entered\":{\"name\":\"date_entered\",\"value\":\"2016-07-02 12:36:44\"},\"date_modified\":{\"name\":\"date_modified\",\"value\":\"2016-07-02 12:36:44\"},\"modified_user_id\":{\"name\":\"modified_user_id\",\"value\":\"1\"},\"created_by\":{\"name\":\"created_by\",\"value\":\"1\"},\"description\":{\"name\":\"description\",\"value\":\"\"},\"deleted\":{\"name\":\"deleted\",\"value\":\"0\"},\"assigned_user_id\":{\"name\":\"assigned_user_id\",\"value\":\"seed_max_id\"},\"salutation\":{\"name\":\"salutation\",\"value\":\"\"},\"first_name\":{\"name\":\"first_name\",\"value\":\"Howard\"},\"last_name\":{\"name\":\"last_name\",\"value\":\"Fricks\"},\"full_name\":{\"name\":\"full_name\",\"value\":\"Howard Fricks\"},\"title\":{\"name\":\"title\",\"value\":\"Director Sales\"},\"department\":{\"name\":\"department\",\"value\":\"\"},\"do_not_call\":{\"name\":\"do_not_call\",\"value\":\"0\"},\"phone_home\":{\"name\":\"phone_home\",\"value\":\"(023) 107-6052\"},\"email\":{\"name\":\"email\",\"value\":\"\"},\"phone_mobile\":{\"name\":\"phone_mobile\",\"value\":\"(058) 861-7434\"},\"phone_work\":{\"name\":\"phone_work\",\"value\":\"(912) 507-8175\"},\"phone_other\":{\"name\":\"phone_other\",\"value\":\"\"},\"phone_fax\":{\"name\":\"phone_fax\",\"value\":\"\"},\"email1\":{\"name\":\"email1\",\"value\":\"sales.kid.phone@example.info\"},\"email2\":{\"name\":\"email2\",\"value\":\"\"},\"invalid_email\":{\"name\":\"invalid_email\",\"value\":\"0\"},\"email_opt_out\":{\"name\":\"email_opt_out\",\"value\":\"0\"},\"primary_address_street\":{\"name\":\"primary_address_street\",\"value\":\"1715 Scott Dr\"},\"primary_address_street_2\":{\"name\":\"primary_address_street_2\",\"value\":\"\"},\"primary_address_street_3\":{\"name\":\"primary_address_street_3\",\"value\":\"\"},\"primary_address_city\":{\"name\":\"primary_address_city\",\"value\":\"Salt Lake City\"},\"primary_address_state\":{\"name\":\"primary_address_state\",\"value\":\"CA\"},\"primary_address_postalcode\":{\"name\":\"primary_address_postalcode\",\"value\":\"33515\"},\"primary_address_country\":{\"name\":\"primary_address_country\",\"value\":\"USA\"},\"alt_address_street\":{\"name\":\"alt_address_street\",\"value\":\"\"},\"alt_address_street_2\":{\"name\":\"alt_address_street_2\",\"value\":\"\"},\"alt_address_street_3\":{\"name\":\"alt_address_street_3\",\"value\":\"\"},\"alt_address_city\":{\"name\":\"alt_address_city\",\"value\":\"\"},\"alt_address_state\":{\"name\":\"alt_address_state\",\"value\":\"\"},\"alt_address_postalcode\":{\"name\":\"alt_address_postalcode\",\"value\":\"\"},\"alt_address_country\":{\"name\":\"alt_address_country\",\"value\":\"\"},\"assistant\":{\"name\":\"assistant\",\"value\":\"\"},\"assistant_phone\":{\"name\":\"assistant_phone\",\"value\":\"\"},\"email_addresses_non_primary\":{\"name\":\"email_addresses_non_primary\",\"value\":\"\"},\"converted\":{\"name\":\"converted\",\"value\":\"0\"},\"refered_by\":{\"name\":\"refered_by\",\"value\":\"\"},\"lead_source\":{\"name\":\"lead_source\",\"value\":\"Trade Show\"},\"lead_source_description\":{\"name\":\"lead_source_description\",\"value\":\"\"},\"status\":{\"name\":\"status\",\"value\":\"Assigned\"},\"status_description\":{\"name\":\"status_description\",\"value\":\"\"},\"reports_to_id\":{\"name\":\"reports_to_id\",\"value\":\"\"},\"report_to_name\":{\"name\":\"report_to_name\",\"value\":\"\"},\"account_name\":{\"name\":\"account_name\",\"value\":\"Hollywood Diner Ltd\"},\"account_description\":{\"name\":\"account_description\",\"value\":\"\"},\"contact_id\":{\"name\":\"contact_id\",\"value\":\"\"},\"account_id\":{\"name\":\"account_id\",\"value\":\"\"},\"opportunity_id\":{\"name\":\"opportunity_id\",\"value\":\"\"},\"opportunity_name\":{\"name\":\"opportunity_name\",\"value\":\"\"},\"opportunity_amount\":{\"name\":\"opportunity_amount\",\"value\":\"\"},\"campaign_id\":{\"name\":\"campaign_id\",\"value\":\"\"},\"campaign_name\":{\"name\":\"campaign_name\",\"value\":\"\"},\"c_accept_status_fields\":{\"name\":\"c_accept_status_fields\",\"value\":\"\"},\"m_accept_status_fields\":{\"name\":\"m_accept_status_fields\",\"value\":\"\"},\"accept_status_id\":{\"name\":\"accept_status_id\",\"value\":\"\"},\"accept_status_name\":{\"name\":\"accept_status_name\",\"value\":\"\"},\"webtolead_email1\":{\"name\":\"webtolead_email1\",\"value\":\"\"},\"webtolead_email2\":{\"name\":\"webtolead_email2\",\"value\":\"\"},\"webtolead_email_opt_out\":{\"name\":\"webtolead_email_opt_out\",\"value\":\"\"},\"webtolead_invalid_email\":{\"name\":\"webtolead_invalid_email\",\"value\":\"\"},\"birthdate\":{\"name\":\"birthdate\",\"value\":false},\"portal_name\":{\"name\":\"portal_name\",\"value\":\"\"},\"portal_app\":{\"name\":\"portal_app\",\"value\":\"\"},\"website\":{\"name\":\"website\",\"value\":\"\"}}}],\"relationship_list\":[]}",
"headers": [
{
"Name": "Pragma",
"Value": "no-cache",
"Type": 3,
"ContentType": null
},
{
"Name": "Content-Length",
"Value": "4528",
"Type": 3,
"ContentType": null
},
{
"Name": "Cache-Control",
"Value": "no-store, no-cache, must-revalidate, post-check=0, pre-check=0",
"Type": 3,
"ContentType": null
},
{
"Name": "Content-Type",
"Value": "application\/json; charset=UTF-8",
"Type": 3,
"ContentType": null
},
{
"Name": "Date",
"Value": "Sat, 17 Dec 2016 21:11:33 GMT",
"Type": 3,
"ContentType": null
},
{
"Name": "Expires",
"Value": "Thu, 19 Nov 1981 08:52:00 GMT",
"Type": 3,
"ContentType": null
},
{
"Name": "Set-Cookie",
"Value": "PHPSESSID=1j0s9s6m3hpqujef7675v69vi2; path=\/",
"Type": 3,
"ContentType": null
},
{
"Name": "Server",
"Value": "Apache\/2.4.7 (Ubuntu)",
"Type": 3,
"ContentType": null
},
{
"Name": "X-Powered-By",
"Value": "PHP\/5.5.9-1ubuntu4.17",
"Type": 3,
"ContentType": null
}
],
"responseUri": "http:\/\/191.101.224.189\/sugar\/service\/v4_1\/rest.php",
"errorMessage": null
}
SugarRestSharp
- Home
- Request
- Request Types
- Request Options
- Response
- Read Module By Id
- Read Module Collection By Page
- Read Module Collection
- Create Module
- Create Module Collection
- Update Module
- Update Module Collection
- Delete Module
- Linked Modules 1
- Linked Modules 2
- Linked Modules 3
- Query Options 1
- Query Options 2
- Query Options 3