Create callouts and write test classes and methods for REST Callouts.
Points to note:
- Future methods (methods with @future annotation – most callouts are or should be) must be static methods and can only return a void type.
- The specified parameters must be primitive data types, arrays of primitive data types, or collections of primitive data types; future methods can’t take objects as arguments.
- You can’t call a future method from a future method. Nor can you invoke a trigger that calls a future method while running a future method.
Learning materials:
- Apex REST Callouts – Trailhead
- Asynchronous Apex – Trailhead
- Writing Test Class for RESTful Services – Video