Skip to content
This repository has been archived by the owner on Oct 12, 2021. It is now read-only.

Read Module By Id

mattkol edited this page Jan 21, 2017 · 2 revisions

Basic Usage

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.

package com.sugaronrest.tests;

import com.sugaronrest.*;
import com.sugaronrest.modules.Leads;

String url = "http://demo.suiteondemand.com/service/v4_1/rest.php";
String username = "will";
String password = "will";

String moduleName = "Leads";
String moduleId = "10a5aca7-a94b-c84a-d01a-587662da31cd";

SugarRestClient client = new SugarRestClient(url, username, password);
SugarRestRequest request = new SugarRestRequest(moduleName, RequestType.ReadById);
request.setParameter(moduleId);

SugarRestResponse response = client.execute(request);

Response (getData())

Leads lead = (Leads)response.getData();

Response (getJData())

{
  "alt_address_city": "",
  "birthdate": false,
  "webtolead_invalid_email": "",
  "lead_source": "Other",
  "phone_work": "(340) 060-8409",
  "alt_address_street": "",
  "created_by_name": "Joe Bloggs",
  "report_to_name": "",
  "invalid_email": "0",
  "primary_address_country": "USA",
  "primary_address_city": "Sunnyvale",
  "email2": "",
  "email1": "[email protected]",
  "email_opt_out": "0",
  "account_description": "",
  "opportunity_name": "",
  "date_entered": "2017-01-11 16:51:02",
  "id": "10a5aca7-a94b-c84a-d01a-587662da31cd",
  "opportunity_amount": "",
  "campaign_id": "",
  "alt_address_state": "",
  "portal_name": "",
  "e_invite_status_fields": "",
  "status_description": "",
  "accept_status_name": "",
  "primary_address_street_3": "",
  "primary_address_street_2": "",
  "lead_source_description": "",
  "primary_address_state": "NY",
  "reports_to_id": "",
  "modified_user_id": "1",
  "e_accept_status_fields": "",
  "created_by": "1",
  "full_name": "Sheryl Polansky",
  "alt_address_postalcode": "",
  "opportunity_id": "",
  "converted": "0",
  "jjwg_maps_geocode_status_c": "",
  "assistant_phone": "",
  "name": "Sheryl Polansky",
  "salutation": "",
  "status": "New",
  "assigned_user_name": "Sally Bronsen",
  "portal_app": "",
  "description": "",
  "event_invite_id": "",
  "title": "Mgr Operations",
  "contact_id": "",
  "jjwg_maps_address_c": "",
  "campaign_name": "",
  "m_accept_status_fields": "",
  "webtolead_email2": "",
  "webtolead_email1": "",
  "phone_home": "(859) 301-1325",
  "alt_address_country": "",
  "account_name": "Sandeon Consolidation Corp",
  "accept_status_id": "",
  "event_status_name": "",
  "department": "",
  "c_accept_status_fields": "",
  "first_name": "Sheryl",
  "email": "",
  "primary_address_postalcode": "84052",
  "phone_mobile": "(181) 586-1013",
  "website": "",
  "phone_fax": "",
  "jjwg_maps_lat_c": "",
  "jjwg_maps_lng_c": "",
  "primary_address_street": "345 Sugar Blvd.",
  "assistant": "",
  "last_name": "Polansky",
  "photo": "",
  "phone_other": "",
  "assigned_user_id": "seed_sally_id",
  "event_status_id": "",
  "webtolead_email_opt_out": "",
  "deleted": "0",
  "alt_address_street_2": "",
  "account_id": "",
  "date_modified": "2017-01-11 16:51:02",
  "event_accept_status": "",
  "modified_by_name": "Joe Bloggs",
  "email_addresses_non_primary": "",
  "alt_address_street_3": "",
  "do_not_call": "0",
  "refered_by": ""
}

Response (getJsonRawRequest())

{
  "method": "get_entry",
  "input_type": "json",
  "response_type": "json",
  "rest_data": {
    "session": "ssvhd6opne84av4p8lfhtecd22",
    "module_name": "Leads",
    "id": "10a5aca7-a94b-c84a-d01a-587662da31cd",
    "select_fields": [
      
    ],
    "link_name_to_fields_array": "",
    "track_view": false
  }
}

Response (getJsonRawResponse())

{
  "entry_list": [
    {
      "id": "10a5aca7-a94b-c84a-d01a-587662da31cd",
      "module_name": "Leads",
      "name_value_list": {
        "assigned_user_name": {
          "name": "assigned_user_name",
          "value": "Sally Bronsen"
        },
        "modified_by_name": {
          "name": "modified_by_name",
          "value": "Joe Bloggs"
        },
        "created_by_name": {
          "name": "created_by_name",
          "value": "Joe Bloggs"
        },
        "id": {
          "name": "id",
          "value": "10a5aca7-a94b-c84a-d01a-587662da31cd"
        },
        "name": {
          "name": "name",
          "value": "Sheryl Polansky"
        },
        "date_entered": {
          "name": "date_entered",
          "value": "2017-01-11 16:51:02"
        },
        "date_modified": {
          "name": "date_modified",
          "value": "2017-01-11 16:51:02"
        },
        "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_sally_id"
        },
        "salutation": {
          "name": "salutation",
          "value": ""
        },
        "first_name": {
          "name": "first_name",
          "value": "Sheryl"
        },
        "last_name": {
          "name": "last_name",
          "value": "Polansky"
        },
        "full_name": {
          "name": "full_name",
          "value": "Sheryl Polansky"
        },
        "title": {
          "name": "title",
          "value": "Mgr Operations"
        },
        "photo": {
          "name": "photo",
          "value": ""
        },
        "department": {
          "name": "department",
          "value": ""
        },
        "do_not_call": {
          "name": "do_not_call",
          "value": "0"
        },
        "phone_home": {
          "name": "phone_home",
          "value": "(859) 301-1325"
        },
        "email": {
          "name": "email",
          "value": ""
        },
        "phone_mobile": {
          "name": "phone_mobile",
          "value": "(181) 586-1013"
        },
        "phone_work": {
          "name": "phone_work",
          "value": "(340) 060-8409"
        },
        "phone_other": {
          "name": "phone_other",
          "value": ""
        },
        "phone_fax": {
          "name": "phone_fax",
          "value": ""
        },
        "email1": {
          "name": "email1",
          "value": "[email protected]"
        },
        "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": "345 Sugar Blvd."
        },
        "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": "Sunnyvale"
        },
        "primary_address_state": {
          "name": "primary_address_state",
          "value": "NY"
        },
        "primary_address_postalcode": {
          "name": "primary_address_postalcode",
          "value": "84052"
        },
        "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": "Other"
        },
        "lead_source_description": {
          "name": "lead_source_description",
          "value": ""
        },
        "status": {
          "name": "status",
          "value": "New"
        },
        "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": "Sandeon Consolidation Corp"
        },
        "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": ""
        },
        "e_invite_status_fields": {
          "name": "e_invite_status_fields",
          "value": ""
        },
        "event_status_name": {
          "name": "event_status_name",
          "value": ""
        },
        "event_invite_id": {
          "name": "event_invite_id",
          "value": ""
        },
        "e_accept_status_fields": {
          "name": "e_accept_status_fields",
          "value": ""
        },
        "event_accept_status": {
          "name": "event_accept_status",
          "value": ""
        },
        "event_status_id": {
          "name": "event_status_id",
          "value": ""
        },
        "jjwg_maps_geocode_status_c": {
          "name": "jjwg_maps_geocode_status_c",
          "value": ""
        },
        "jjwg_maps_lat_c": {
          "name": "jjwg_maps_lat_c",
          "value": ""
        },
        "jjwg_maps_lng_c": {
          "name": "jjwg_maps_lng_c",
          "value": ""
        },
        "jjwg_maps_address_c": {
          "name": "jjwg_maps_address_c",
          "value": ""
        }
      }
    }
  ],
  "relationship_list": [
    
  ]
}