You need to sign in to do that
Don't have an account?
Rima KACI
REST Web Service
Hi,
Can anyone tell me how to expose REST webserive.
How to write classe and method which return List<Task> from salesforce
retreiveTaskByDates(DateTime start, DateTime end)
thanks for help
Can anyone tell me how to expose REST webserive.
How to write classe and method which return List<Task> from salesforce
retreiveTaskByDates(DateTime start, DateTime end)
thanks for help
Yes, you can use HttpPost annotation and HttpGet annotation as per your requirement and In both POST and GET you can use parameters in URL.
In the following code, we pass parameters (DateStart and DateEnd) in URL and debug these parameters in the rest class, you can use them as per your requirement.
Try this Url for Hit rest class:'/services/apexrest/taskRestClass?DateStart=08/07/2019&DateEnd=10/07/2019':
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
All Answers
Try the following rest class, it may be helpful for you:
Try this Url:'/services/apexrest/taskRestClass':
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
I hope you are doing well, You can expose your Apex classes and methods so that external applications can access
your code and your application through the REST architecture.
These link will help you to know how to implement a simple REST API in Apex.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest_code_sample_basic.htm
https://trailhead.salesforce.com/en/content/learn/modules/apex_integration_services/apex_integration_webservices
https://trailhead.salesforce.com/en/content/learn/modules/apex_integration_services/apex_integration_webservices
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi
@Deepali, can I use the same code with Httppost annotation?
I've seconde question about method's parameters (DateStart and DateEnd) these two parameters are sending from third-party system.
how can'I recover this parameters from request sending by third-system call?
thanks for your help
Yes, you can use HttpPost annotation and HttpGet annotation as per your requirement and In both POST and GET you can use parameters in URL.
In the following code, we pass parameters (DateStart and DateEnd) in URL and debug these parameters in the rest class, you can use them as per your requirement.
Try this Url for Hit rest class:'/services/apexrest/taskRestClass?DateStart=08/07/2019&DateEnd=10/07/2019':
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha