@@ChrisMarquez Thanks for your response. Calling other api's and handling response with custom exception handling would be great to know if possible. Thanks.
Hi Chris i really admire your content these are realistic example.. just a question here can't we need to create the connected app here in salesforce? or you missed this part in the video ? please help....
Hey Santanu, this video is part of my Salesforce Web Service playlist that can be found here: ua-cam.com/play/PLL3Iw8hs1Qkq5-feSfNvYUytNe6pl1OEV.html The first video covers connected apps. Let me know if you have any other questions.
Sir suppose I have AL3 file in my desktop and I need to convert that format and read using third party API how I will upload file in that API and retrieve that file in particular format without the use of any object just normally passing desktop file.
Hi Chris, can you also post a video on making a callout and sending a POST Request? For example, how do you pass parameters to a JSON string and send it to an external system in apex?
That would depend on the actual requirements such as should the web service accept multiple records of each or just one, handling of only partial data provided, should this data be considered new or do you have to check to see if it might already exist in the org, does the external system provide an external id for each record, etc. Generally speaking, for the json representation part, you could create inner classes to represent each of the records and then instantiate a list for each at the outer class level. The opportunity class could contain a list of opportunity line items objects. Hopefully this makes sense. I'll make a video that goes more into depth soon.
Hello Prateek. I'll make a video on this topic soon but here is a quick explanation of what you can do: - To update a record, create a new method in your web service class with the "@HttpPatch" annotation. This annotation is typically used to update existing records. This method will need to have logic to identify if the request received is valid, contains a unique identifier that you can use to associate with a record in the system, and contains key/values that are valid. This method should utilize the update DML statement. - To update a record using postman, create a PATCH request and include the JSON with key/values that you want changed. Hope this helps.
I made a mistake for the return type of the "createSupply" method. It is not necessary to serialize the response since the system automatically does that for us. The correct thing to do is to set the return type of createSupply to SupplyJSONWrapper.response and simply return that without using the "JSON.serialize" method. Example: @HttpPost global static SupplyJSONWrapper.response createSupply(){ ... SupplyJSONWrapper.response response = new SupplyJSONWrapper.response(); response.success = success; response.message = message; return response; } Doing it this way will ensure that the response is not serialized twice. I'll go over this mistake in my next video.
Thanks for the simple explanation. Please do make more REST Web Services videos under the same series.
Thanks for watching. Sure, is there anything specific you want to see with REST Web Services?
@@ChrisMarquez Thanks for your response. Calling other api's and handling response with custom exception handling would be great to know if possible. Thanks.
Brilliant video. Deeply helpful thanks!
Glad it was helpful!
Hi Chris, brilliant video very useful to me..a big THANKS. Liked & subscribed
Much appreciated! Let me know if there are any topics you would like to see me make videos on.
Man this is SO helpful for me. Thank you! Liked and subbed
Much appreciated! Let me know if there are any topics you would like me to cover.
Hi Chris i really admire your content these are realistic example.. just a question here can't we need to create the connected app here in salesforce? or you missed this part in the video ? please help....
Hey Santanu, this video is part of my Salesforce Web Service playlist that can be found here: ua-cam.com/play/PLL3Iw8hs1Qkq5-feSfNvYUytNe6pl1OEV.html
The first video covers connected apps. Let me know if you have any other questions.
Thanks Christ!
You're welcome!
Sir suppose I have AL3 file in my desktop and I need to convert that format and read using third party API how I will upload file in that API and retrieve that file in particular format without the use of any object just normally passing desktop file.
Hi Chris, can you also post a video on making a callout and sending a POST Request? For example, how do you pass parameters to a JSON string and send it to an external system in apex?
Hey Kolumam, sure no problem. I'll post a video on this in a few days.
Here you go: ua-cam.com/video/nDGZYRKbskU/v-deo.html
@@ChrisMarquez Thank you for the video. Let me watch it and will provide you my feedback.
How would you handle creating Records on 4 different objects like: Contact , Account, Opportunity, Opportunity Line item all from a single JSON Post
That would depend on the actual requirements such as should the web service accept multiple records of each or just one, handling of only partial data provided, should this data be considered new or do you have to check to see if it might already exist in the org, does the external system provide an external id for each record, etc.
Generally speaking, for the json representation part, you could create inner classes to represent each of the records and then instantiate a list for each at the outer class level. The opportunity class could contain a list of opportunity line items objects.
Hopefully this makes sense. I'll make a video that goes more into depth soon.
How to update a record using apex rest web service and postman
Hello Prateek. I'll make a video on this topic soon but here is a quick explanation of what you can do:
- To update a record, create a new method in your web service class with the "@HttpPatch" annotation. This annotation is typically used to update existing records. This method will need to have logic to identify if the request received is valid, contains a unique identifier that you can use to associate with a record in the system, and contains key/values that are valid. This method should utilize the update DML statement.
- To update a record using postman, create a PATCH request and include the JSON with key/values that you want changed.
Hope this helps.
@@ChrisMarquez thank you for the reply Chris 👍👍
@@prateekmishra2755 here is a link to my new video that explains the solution: ua-cam.com/video/DXXukMafYYU/v-deo.html
10:47 Note
I made a mistake for the return type of the "createSupply" method.
It is not necessary to serialize the response since the system automatically does that for us. The correct thing to do is to set the return type of createSupply to SupplyJSONWrapper.response and simply return that without using the "JSON.serialize" method.
Example:
@HttpPost
global static SupplyJSONWrapper.response createSupply(){
...
SupplyJSONWrapper.response response = new SupplyJSONWrapper.response();
response.success = success;
response.message = message;
return response;
}
Doing it this way will ensure that the response is not serialized twice.
I'll go over this mistake in my next video.