Get labels of all the fields available for a module

Hello,

I have a requirement where I need to get the list of all fields available for a module. I am currently using this endpoint to get the data:

/rest/v11/metadata?type_filter=modules&module_filter=Contacts

Everything is working fine with this except the label. The response doesn't have anything that can be shown as a label for the user on our side.

'First Name' instead of 'first_name'.

Is there anything that can be done for this?

I have attached the response format I am getting.

  • As far I know SugarCRM REST api has no an endpoint which provides language entries given a module name, so you would need to implement such endpoint.

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • /rest/v11/lang/en_us

    will give you all the labels for the whole application in English US.

    Change the language to what you need.

    get your results into an array $results and look for $results['mod_strings']['Contacts'] to get the labels for contacts.

    HTH

    FrancescaS

  • Thanks a lot! It's there.

  • Do you know if the same (or something like it) is available with v2 version?

  • As the Sugar application with versions less than 7.0 did not need the labels in the browser there was no web service call to load them, all language translation was made on the server. So API v1-v4_1 do not contain calls which deliver any lull language sets.

    But the V2-V4_1 SOAP/REST call get_module_fields returns the list of all fields of a given module and in the list of fields you find the label of each field.  

    Fullscreen
    1
    2
    3
    4
    5
    6
    $setParams = array(
    'session' => $session_id,
    'module_name' => 'Contacts',
    'fields' => '',
    );
    $result = call('get_module_fields',$setParams,$url);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    returns the list of all fields in module Contacts, which looks like this:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    stdClass Object
    (
    [module_name] => Contacts
    [module_fields] => stdClass Object
    (
    [id] => stdClass Object
    (
    [name] => id
    [type] => id
    [label] => ID:
    [required] => 1
    [options] => Array
    (
    )
    )
    [name] => stdClass Object
    (
    [name] => name
    [type] => fullname
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    So the value of the label for the field "name" can be found in $result->module_fields->name->label

    Harald Kuske
    Principal Solution Architect – Professional Services, EMEA
    hkuske@sugarcrm.com
    SugarCRM Deutschland GmbH