You need to sign in to do that
Don't have an account?
bharath kuppala
@RestResource(urlMapping='/AccountCreation/*')
global with sharing class Ebuy_CreateAccount
{
@HttpPost
global Static String doPost(String Company, String Country, String Address1, String Address2, String Zipcode, String City)
{
List<RecordType> rt = [SELECT Id,Name FROM RecordType WHERE DeveloperName = 'EMGCustomerRecordType' LIMIT 1];
String sid = rt[0].Id;
String response = '';
Try
{
Account acc = new Account();
acc.RecordTypeId = sid;
acc.Name = Company;
acc.Street1__c = Address1;
acc.Street2__c = Address2;
acc.ZipCode__c = Zipcode;
acc.City__c = City;
acc.Country__c = Country;
acc.AccountSource = 'Ebuy';
acc.isVerified__c = false;
insert acc;
response = acc.Id;
}
Catch(Exception ex)
{
system.debug('@@@ Exception Message = ' + ex.getMessage());
if((ex.getMessage()).contains('Required fields are missing'))
{
response = 'REQUIRED FIELD MISSING : '+ex.getMessage();
}
}
return response;
}
}
i am getting transfer chunked error for these rest api class
@RestResource(urlMapping='/AccountCreation/*')
global with sharing class Ebuy_CreateAccount
{
@HttpPost
global Static String doPost(String Company, String Country, String Address1, String Address2, String Zipcode, String City)
{
List<RecordType> rt = [SELECT Id,Name FROM RecordType WHERE DeveloperName = 'EMGCustomerRecordType' LIMIT 1];
String sid = rt[0].Id;
String response = '';
Try
{
Account acc = new Account();
acc.RecordTypeId = sid;
acc.Name = Company;
acc.Street1__c = Address1;
acc.Street2__c = Address2;
acc.ZipCode__c = Zipcode;
acc.City__c = City;
acc.Country__c = Country;
acc.AccountSource = 'Ebuy';
acc.isVerified__c = false;
insert acc;
response = acc.Id;
}
Catch(Exception ex)
{
system.debug('@@@ Exception Message = ' + ex.getMessage());
if((ex.getMessage()).contains('Required fields are missing'))
{
response = 'REQUIRED FIELD MISSING : '+ex.getMessage();
}
}
return response;
}
}
One solution is to create a custom policy plugin and override the method to remove the Transfer-Encoding header if it equals chunked using HTTP Request object.
Refer this link
https://stackoverflow.com/questions/41385736/how-to-avoid-chunked-encoding-when-the-rest-api-is-passing-through-apiman