tag:blogger.com,1999:blog-8643239839712475364.post3821354168030030821..comments2024-02-15T21:18:33.934-08:00Comments on SFDC Stop: Salesforce Integration Tutorial Part 8 - Apex REST CalloutsRahul Malhotrahttp://www.blogger.com/profile/12391262239143475497noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-8643239839712475364.post-78248117851890525132021-05-21T10:34:46.447-07:002021-05-21T10:34:46.447-07:00thanks buddythanks buddyAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8643239839712475364.post-49998375269955930652020-12-25T23:15:53.661-08:002020-12-25T23:15:53.661-08:00You can use response.getStatusCode() to check the ...You can use response.getStatusCode() to check the code and manage it accordingly.Rahul Malhotrahttps://www.blogger.com/profile/12391262239143475497noreply@blogger.comtag:blogger.com,1999:blog-8643239839712475364.post-5041606455635221302020-12-11T12:26:11.097-08:002020-12-11T12:26:11.097-08:00In your callout how would you handle a code 500 re...In your callout how would you handle a code 500 return with "try and catch"?Célio Xavierhttps://www.blogger.com/profile/03421662061006838251noreply@blogger.comtag:blogger.com,1999:blog-8643239839712475364.post-39011276460743763952020-12-11T12:25:50.202-08:002020-12-11T12:25:50.202-08:00No seu callout como você faria para tratar um reto...No seu callout como você faria para tratar um retorno código 500 com o "try and catch"? Célio Xavierhttps://www.blogger.com/profile/03421662061006838251noreply@blogger.comtag:blogger.com,1999:blog-8643239839712475364.post-79355883514183729472020-07-14T22:59:37.011-07:002020-07-14T22:59:37.011-07:00Great post with all minute detailsGreat post with all minute detailshitesh kalahttps://www.blogger.com/profile/07930567911909770418noreply@blogger.comtag:blogger.com,1999:blog-8643239839712475364.post-14542873375190068872020-05-30T07:46:58.864-07:002020-05-30T07:46:58.864-07:00Hi Sasiraja, most commonly this issue is coming be...Hi Sasiraja, most commonly this issue is coming because your wrapper is not correct. Try creating a wrapper using this tool for your JSON:- https://json2apex.herokuapp.com/Rahul Malhotrahttps://www.blogger.com/profile/12391262239143475497noreply@blogger.comtag:blogger.com,1999:blog-8643239839712475364.post-58473382126256973042020-05-24T06:51:27.671-07:002020-05-24T06:51:27.671-07:00Rahul - Can you please help me with following erro...Rahul - Can you please help me with following error while deserializing JSON. Error : Malformed JSON: Expected '{' at the beginning of object. With the help of your code I am trying to use Postal India API, but getting error at (postalDetails = PostalWrapperClass.deserialize(response.getBody());), below is the code<br /><br />Code<br /><br />public class PostalApiCall {<br /> @AuraEnabled<br /> public static PostalWrapperClass fetchPostOfficeDetails(String postalCode){<br /> system.debug('Inside server method to execute details');<br /> PostalWrapperClass postalDetails = new PostalWrapperClass();<br /> HTTPRequest request = new HTTPRequest();<br /> request.setEndpoint('https://api.postalpincode.in/pincode/'+postalCode);<br /> request.setMethod('GET');<br /> HTTP objHTTP = new HTTP();<br /> HTTPResponse response = objHTTP.send(request);<br /> system.debug('Response is'+ response.getBody());<br /> //String rawData = response.getBody().toString();<br /> //PostalWrapperClass pw = new PostalWrapperClass();<br /> //postalDetails = (PostalWrapperClass)System.JSON.deserialize(response.getBody(), PostalWrapperClass.class);<br /> //response = (stackExchangeAPI.responseResource)JSON.deserialize(responseBody,stackExchangeAPI.responseResource.class);<br /> //system.debug('#######'+pw);<br /> postalDetails = PostalWrapperClass.deserialize(response.getBody());<br /> system.debug('Postal details after Deserialization ::' + postalDetails);<br /> return postalDetails;<br /> }<br />}<br /><br />public class PostalWrapperClass {<br /> @AuraEnabled<br /> public String Message;<br /> @AuraEnabled<br /> public String Status;<br /> @AuraEnabled<br /> public List PostOffice;<br /><br /> public class PostOffice{<br /> @AuraEnabled<br /> public String Name;<br /> @AuraEnabled<br /> public String Description;<br /> @AuraEnabled<br /> public String BranchType;<br /> @AuraEnabled<br /> public String DeliveryStatus;<br /> @AuraEnabled<br /> public String Circle;<br /> @AuraEnabled<br /> public String District;<br /> @AuraEnabled<br /> public String Division;<br /> @AuraEnabled<br /> public String Region;<br /> @AuraEnabled<br /> public String State;<br /> @AuraEnabled<br /> public String Country;<br /> }<br /> public static PostalWrapperClass deserialize(String res){<br /> return (PostalWrapperClass)JSON.deserialize(res, PostalWrapperClass.class);<br /> }<br />}sasirajahttps://www.blogger.com/profile/06258277115324872709noreply@blogger.comtag:blogger.com,1999:blog-8643239839712475364.post-74193313602774851232020-03-26T08:26:56.854-07:002020-03-26T08:26:56.854-07:00Replied above to your queryReplied above to your queryRahul Malhotrahttps://www.blogger.com/profile/12391262239143475497noreply@blogger.comtag:blogger.com,1999:blog-8643239839712475364.post-1838030124631045552020-03-26T08:26:39.790-07:002020-03-26T08:26:39.790-07:00Hi,
You can't connect it to localhost. You sh...Hi,<br /><br />You can't connect it to localhost. You should host your application on an actual server (like I have hosted on heroku), have an API endpoint of your application that can be called from Salesforce. Then you can fetch and display the data in a lightning component and finally add that lightning component to the account detail page.<br /><br />Hope that helps..!!<br />Rahul Malhotrahttps://www.blogger.com/profile/12391262239143475497noreply@blogger.comtag:blogger.com,1999:blog-8643239839712475364.post-46694035666909235352020-03-26T04:19:59.634-07:002020-03-26T04:19:59.634-07:00How and where use this data in mu salesforce accou...How and where use this data in mu salesforce account please explain.Anonymoushttps://www.blogger.com/profile/15894970838161372900noreply@blogger.comtag:blogger.com,1999:blog-8643239839712475364.post-1981962662214936162020-03-26T04:11:57.271-07:002020-03-26T04:11:57.271-07:00Hi thanks for the video. In my case i wanna fetch ...Hi thanks for the video. In my case i wanna fetch data from my application (or from localhost ) to the salesforce where i can display the data. i want that when any user is register to my application i can see the user to my salesforce account. please help me. thank you.Anonymoushttps://www.blogger.com/profile/15894970838161372900noreply@blogger.com