I am writing a rest request from Java app to salesforce. My end point may change their fields from time to time. So I want to make request body field names configuration either through xml or properties file, so that if body is added in end point side, the same we will add in our property and work will be done with minimum changes. Can any one suggest me if I will create a property file like below and how can we set this value ${recodeTypeID} from core Java application?
config.properties
RecordTypeId=${recodeTypeID}
FirstName=${FirstName}
or otherwise in xml in which display tag having field name and input having value.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<leads>
<fields>
<field>
<display>"ID DATA SOURCE"</display>
<input>ID_DATA_SOURCE</input>
</field>
<field>
<display>"CPF"</display>
<input>CPF</input>
</field>
<field>
<display>"NM PERSON"</display>
<input>NM_PERSON</input>
</field>
<field>
<display>"TP GENDER"</display>
<input>TP_GENDER</input>
</field>
<field>
<display>"DT BIRTH DATE"</display>
<input>DT_BIRTH_DATE</input>
</field>
</leads>
My RequestBody is below:
JSONObject leads = new JSONObject();
leads.put("RecordTypeId","0126A000000BAIzQAO");
leads.put("FirstName", "Prabhat");
leads.put("Company", "Tests Enterprises");
leads.put("LeadProfile__c", "");
leads.put("Email", "test@email.com");
leads.put("Phone", "1155550000");
leads.put("MobilePhone", "11955550000");
leads.put("ContactPreference__c", "Email");
leads.put("CNPJ__c", "10212469000148");
leads.put("CPF__c", "");
leads.put("Street", "");
leads.put("PostalCode", "");
leads.put("City", "");
leads.put("State", "");
leads.put("Country", "");
leads.put("DealerCode__c", "04659");
leads.put("TMA__c", "KHC");
leads.put("Catalog__c", "KAA8");
leads.put("ModelYear__c", "2018");
leads.put("Color__c", "");
leads.put("InternalFinish__c", "");
leads.put("LeadSource", "Web");
leads.put("LeadSubSource__c", "Website");
leads.put("InterestType__c", "");
leads.put("AgreeReceiveContact__c", "true");
Thanks.