4. @sfdgblr #blrdevx
Index
• What & Why of Integration
• All about REST
• Types of authentications
• OAuth & it’s versions
• Demo
• Coding practices
• Mock class use cases
• Error handling
• Q&A
5. @sfdgblr #blrdevx
What & Why of Integration
• In todays’ world, every company uses different systems for different tasks
• Data remains in silos and affects efficient decision making
• Integration helps in bringing data from all all sources into one System, which then acts as the
Source of Truth.
• Helps in decision making
• There is hardly any argument on the fact that APIs are increasingly becoming an important part
of how companies do business. API has become the de facto standard to unlock one of their
most valuable resources, data [MuleSoft Blog]
6. @sfdgblr #blrdevx
All about REST
• RESTful API design was defined by Dr. Roy Fielding. In order to be a true RESTful API, a web
service must adhere to the following six REST architectural constraints:
• Use of a uniform interface [GET,PUT, POST, DELETE, etc..]
• Client-Server based
• Stateless operation
• Resource Caching
• Layered System
• Code on Demand
7. @sfdgblr #blrdevx
Types of Authentication
• Username + password based
• Token based
• SSO based
• Oauth based
• And few others….
11. @sfdgblr #blrdevx
OAuth
• There are 3 Components in OAuth Mechanism–
• OAuth Provider – This is the OAuth provider Eg. Google, Facebook etc.
• OAuth Client – This is the website where we are sharing or authenticating the usage of our
information. Eg. Salesforce, Zomato, Uber, StackOverflow, Salesforce
• Owner – The user whose login authenticates sharing of information [Source]
15. @sfdgblr #blrdevx
Coding Practices
• Modular functions
• Focus on reducing LOC in the org
• Code reusability means faster development and deployment cycle
• Following uniform coding conventions
16. @sfdgblr #blrdevx
Mock class use cases
• Either implement HttpCalloutMock or use (Multi)StaticResourceCalloutMock
• Focus on Code reusability
• Handling multiple callouts using Generic Mock classes [demo]
• Providing room for multiple levels of success & error handling
17. @sfdgblr #blrdevx
Error handling
• Make programs robust and always provide a message to end user
• Approach to persist errors for future troubleshooting
• Handling failures at every level of callout and response parsing