├── HTTPCalloutsExamples.apxc ├── MyFirstRESTAPI.apxc ├── README.md └── JSONExamples.apxc /HTTPCalloutsExamples.apxc: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /MyFirstRESTAPI.apxc: -------------------------------------------------------------------------------- 1 | @RestResource(urlMapping='/myapi') 2 | global class MyFirstRESTAPI { 3 | 4 | @HttpGet 5 | global static String fetchAccount(){ 6 | RestRequest req = RestContext.request; 7 | RestResponse res = RestContext.response; 8 | 9 | Map params = req.params; 10 | System.debug('params = '+params); 11 | 12 | String jsonbody = req.requestBody.toString(); 13 | System.debug('jsonbody = '+jsonbody); 14 | 15 | //url paramameter 16 | //URI 17 | //methods 18 | //headers 19 | 20 | List accountsList = [select id,name,website,accountnumber from account]; 21 | String jsonstring = JSON.serialize(accountsList); 22 | return jsonstring; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # sfdc-integration-bootcamp 2 | 3 | 1. **Salesforce Integration Bootcamp Assignments:** https://bit.ly/3paK9E5 4 | 2. **Salesforce Integration Bootcamp Slides:** https://bit.ly/41b6C12 5 | 3. **Salesforce Integration Bootcamp Notes:** https://bit.ly/44BeNXp 6 | 4. **Salesforce Integration Bootcamp Sheet:** https://bit.ly/3pktVs6 7 | 8 | **Session #1: 13th May 2023** 9 | - What is Integration? 10 | - Integration Terminologies  11 | - What is Webservices? 12 | - JSON Fundamentals using Apex 13 | - REST API Fundamentals - REST Callouts & REST Services using Apex 14 | - Postman Tool Fundamentals 15 | 16 | **Session #2: 03rd June 2023** 17 | - Authentication Fundamentals 18 | - Authentication in REST API 19 | - Connected Apps 20 | - Auth Providers 21 | - Username and Password Based Authentication in REST API's 22 | - Named Credentials 23 | 24 | **Session #3: TBD** 25 | - Implementation of OAuth 2.0 26 | - Implementation of JWT 27 | 28 | **Session #4: TBD** 29 | - Fundamentals of Integration Patterns 30 | - Implementation of Integration Patterns 31 | - Integration Best Practices 32 | - Integration Framework/Integration Design Patterns in Apex 33 | 34 | -------------------------------------------------------------------------------- /JSONExamples.apxc: -------------------------------------------------------------------------------- 1 | public class JSONExamples { 2 | 3 | 4 | public static void jsonexample1(){ 5 | StaticResource st = [Select id,name,body from StaticResource where Name=:'JSONFormat1' limit 1]; //Data is Received from System 1 6 | System.debug('JSON Data from System 1 = '+st.Body.toString()); 7 | 8 | JSONParser parser = JSON.createParser(st.Body.toString()); 9 | parser.nextToken(); //{ 10 | parser.nextToken(); //"status": key 11 | System.debug(parser.getCurrentName()); 12 | if(parser.getCurrentName() == 'status'){ 13 | parser.nextToken(); 14 | String value = parser.getText(); 15 | System.debug('value = '+value); 16 | } 17 | parser.nextToken(); 18 | System.debug(parser.getCurrentName()); 19 | parser.nextToken(); 20 | String value1 = parser.getText(); 21 | System.debug('value1 = '+value1); 22 | //String value = parser.getText(); 23 | // System.debug('value = '+value); 24 | //parser.nextToken(); 25 | //System.debug(parser.getCurrentName()); 26 | 27 | //Manual Parser/Generation 28 | //JSON 29 | //JSONParser 30 | //JSONGenerator 31 | // 32 | //Seralize & desealize 33 | 34 | } 35 | 36 | public static void jsonexample2(){ 37 | StaticResource st = [Select id,name,body from StaticResource where Name=:'JSONFormat1' limit 1]; //Data is Received from System 1 38 | //System.debug('JSON Data from System 1 = '+st.Body.toString()); 39 | 40 | EmployeeInfo info = (EmployeeInfo) JSON.deserialize(st.Body.toString(), EmployeeInfo.class); 41 | //System.debug('info = '+info.status); 42 | //System.debug('info = '+info.data); 43 | 44 | String jsontext = JSON.serialize(info); 45 | System.debug('jsontext = '+jsontext); 46 | } 47 | 48 | class EmployeeInfo{ 49 | string status{get;set;} 50 | List data{get;set;} 51 | } 52 | 53 | class Emolpyee{ 54 | string id{get;set;} 55 | Integer seatnumber{get;set;} 56 | string employee_name{get;set;} 57 | string employee_salary{get;set;} 58 | list addresess; 59 | } 60 | 61 | public static void jsonexample3(){ 62 | JSONGenerator generator = JSON.createGenerator(true); 63 | generator.writeStartObject(); //{ 64 | 65 | generator.writeStringField('status', 'success'); 66 | generator.writeNumberField('seat', 100); 67 | 68 | generator.writeFieldName('data'); 69 | generator.writeStartArray();//[ 70 | 71 | generator.writeStartObject(); 72 | generator.writeStringField('id', '1'); 73 | generator.writeStringField('employee_name', 'Aniket'); 74 | generator.writeEndObject(); 75 | 76 | generator.writeEndArray();//] 77 | generator.writeEndObject();//} 78 | String jsonstring = generator.getAsString(); 79 | System.debug('jsonstring = '+jsonstring); 80 | 81 | } 82 | 83 | 84 | } 85 | --------------------------------------------------------------------------------