You need to sign in to do that
Don't have an account?
Vigneshwaran Loganathan
Hi,
I have written a call out function like above. It shows the following Error in debug log
Any help? What does it mean?
Thanks frnz.
FATAL_ERROR System.JSONException: Malformed JSON: Expected '{' at the beginning of object
@future(callout=true) public static void ListCallAllowanceBalanceRequest() { accx=[Select id,Name,Billing_Date__c,AccountNumber__c,Client_ID__c,Start_Date__c,End_Date__c,Bill_Hold__c,Bill_Talk__c,Bill_Transfer__c,Bill_Ring__c,Call_Rounding__c from Account WHERE To_Be_Run_Today__c = 'True']; for(Account accy:accx) { wrap.StartDate=accy.Start_Date__c; wrap.EndDate=accy.End_Date__c; wrap.ClientId=accy.Client_ID__c; wrap.BillHold = Boolean.ValueOf(accy.Bill_Hold__c); system.debug('****billhold****'+wrap.BillHold); wrap.BillTalk = Boolean.ValueOf(accy.Bill_Talk__c); wrap.BillTransfer= Boolean.ValueOf(accy.Bill_Transfer__c); wrap.BillRing = Boolean.ValueOf(accy.Bill_Ring__c); wrap.RoundCalls = accy.Call_Rounding__c; wrap.CustomerName= autx.Customer_Name__c; wrap.UserName = autx.User_Name__c; wrap.Password = autx.Password__c; String jsonBody = json.serialize(wrap); system.debug(jsonBody); HttpResponse res; HttpRequest req = new HttpRequest(); req.setEndPoint('https://telassistant.hostedsuite.com/api/json/reply/ListCallAllowanceBalanceRequest'); req.setMethod('POST'); req.setHeader('Content-Type','application/json'); req.setBody(jsonBody); Http http_req = new Http(); res = http_req.send(req); System.Debug(res.toString()); try { res = http_req.send(req); System.debug('>>>>>res'+res.getBody()); string httpresp = res.getBody(); deserialize1 qw= new deserialize1(); qw=(deserialize1)JSON.deserialize(httpresp,deserialize1.class); system.debug('***userid***' + qw.NumCalls); listacc1.Num_calls__c =qw.NumCalls; kk.add(listacc1); system.debug('NumCalls'+listacc1.Num_calls__c); } catch(System.CalloutException e) { System.debug('Callout error: '+ e); System.debug(res.toString()); } update kk; } }
public class deserialize1 { public boolean Authenticated {get; set;} public string UserType {get; set;} public string body {get; set;} public string Name {get; set;} public string CompanyName {get; set;} public string userId {get; set;} public string ClientId {get; set;} public string PhotoUrl {get; set;} public Integer NumCalls{get; set;} }
Hi,
I have written a call out function like above. It shows the following Error in debug log
Any help? What does it mean?
Thanks frnz.
Thanks for the Reply :)
Actually here is the the code. I have modified with ur suggestion but still same,
What is the mistake I am doing here?
Thank you so much :)