Pain Points with Traditional Approach
What is Salesforce Composite API?
What an sObject is, Batch is and Composite Request is?
How to create nested records of the same type?
How to create multiple, unrelated records of the same type?
Limitations of the Salesforce composite connectors
Comparison between Batch, Composite Request and sObject Tree
Live Demo
2. Organizers
2
About Organizer:
Working as Senior Solution Architect at Capgemini.
12.5 Years of Integration and APIs Experience.
MuleSoft Ambassador
Surat MuleSoft Meetup Leader
MuleSoft Certified Integration and Platform Architect.
3. 3
Organizers
Nitish Jain
Consultant
IBM
About the Organizer :
Working as Consultant at IBM.
Surat MuleSoft Meetup Leader.
2.5+ Years of Experience in Integrations and API Technologies.
Certified MuleSoft Developer and Platform Architect.
4. Speaker
4
About Speaker:
11 years of Technical Experience.
6 years of Experience in the Integration Domain.
Certified Mulesoft Architect.
Mule Meetup Speaker.
Coimbatore Mule Meetup Leader
5. CHEERS..!!
We have prizes to give away!
3 Winners a special prize is ready
5
A SHOW OF HANDS:
New Members With Us.!!
6. Pain Points with Traditional Approach
What is Salesforce Composite API?
What an sObject is, Batch is and Composite Request is?
How to create nested records of the same type?
How to create multiple, unrelated records of the same type?
Limitations of the Salesforce composite connectors
Comparison between Batch, Composite Request and sObject Tree
Live Demo
Agenda
6
7. Use Case: Create Account And Contact as Parent-Child Relationship
● Multiple round trips between Mulesoft and SFDC
● Manually need to extract details for Subsequent API Call
● Multiple API Calls towards API Limits
● No Transaction management
Pain points with Traditional Approach
7
8. ● Mulesoft OOTB Connector
● Its Composite - single call towards our API limits.
● It uses a single REST API call to access several individual Salesforce services
○ Thereby simplifying your code.
○ Reducing network overhead by reducing round trips between Mulesoft and SFDC.
○ Improving your app’s performance.
○ Transaction management.
● Always returns HTTP Status as 200 by top level request.
● Single response body with all subrequest’s responses.
What is Salesforce Composite API Connector?
8
9. Single API call for upto 25 subrequest
One Request-Response
One Subrequest response can be used as
request for other subrequest
It expects payload as an Object
Transaction Management
Rollback on Failure
allOrNone= true/false
Top level request always returns HTTP
200 in either case
Response includes all subrequest
responses
Composite Request
9
{ "allOrNone":true,
"compositeRequest":[ {
"method":"POST",
"url":"/services/data/v51.0/sobjects/Account",
"referenceId":"refAccount",
"body":{
"Name":"SFDC compositeRequest"
}
}, {
"method":"GET",
"url":"/services/data/v51.0/query/?q=select+id+fr
om+contact+where+lastname='Barr'",
"referenceId":"refContact"
}, {
"method":"PATCH",
"url":"/services/data/v51.0/sobjects/Contact/@{re
fContact.records[0].Id}",
"referenceId":"refContactUpdated",
"body":{
"AccountId":"@{refAccount.id}"
}
}
]
}
10. Single API call for upto 25 independent
subrequest
One Request-Response
Each subrequest counts against rate limits
It expects payload as an Array
Transaction Management
Rollback on Failure
haltOnError = true/false
Sequential and Synchronous
Composite Batch
10
{
"batchRequests":[
{
"method":"PATCH",
"url":"v51.0/sobjects/account/0012w00000d5RzP",
"richInput":{
"Name":"Coimbatore Mulesoft Meetup"
}
},
{
"method":"GET",
"url":"v51.0/sobjects/contact/0032w00000FX8eZ?f
ields=Name, Title"
}
]
}
11. Creates one or more sObject trees with root
records of the specified type.
An sObject tree is a collection of nested,
parent-child records with a single root record.
It expects Payload to be an Array.
Limitations:
Up to a total of 200 records across all
trees.
Up to five records of different types.
sObject trees up to five levels deep.
sObject Tree
11
{ "records":[ {
"attributes":{
"type":"Account","referenceId":"ref1" },
"name":"Mulesoft",
"phone":"3125961000",
"website":"www.salesforce.com",
"numberofEmployees":"100",
"industry":"Integration",
"Contacts":{
"records":[ {
"attributes":{ "type":"Contact","referenceId":"ref2"},
"lastname":"John",
"title":"CFO",
"email":"John@salesforce.com"
}, {
"attributes":{ "type":"Contact", "referenceId":"ref3"},
"lastname":"Joss",
"title":"VP, Production",
"email":"joss@salesforce.com"
}
]
}
}, {
"attributes":{"type":"Account", "referenceId":"ref4"},
"name":"Oracle",
"phone":"2128425500",
"website":"www.oracle.com",
"numberofEmployees":"100000",
"industry":"Database"
}
]
}
14. Consumer Key
The consumer key for the Salesforce connected app
Consumer Secret
The consumer secret for the connector to access Salesforce
Username
The Salesforce username
Password
The corresponding password
Security Token
The corresponding security token
Required Parameters
14
16. Get ready to WIN a Special Gift from MuleSoft Community
Quiz Time
17. Question 1
Requests in a composite call are called...?
a. Subrequests
b. Duplicaterequests
c. Childrequests
d. None of the Above
17
18. Question 2
What is max Object limit of Composite Request?
a. 15
b. 20
c. 25
d. 30
18
19. Question 3
How many objects does sObject collection support in one
single request?
a. 100
b. 200
c. 300
d. 400
19
20. 20
Share:
○ Tweet your pictures using the hashtag #SuratMuleSoftMeetup
○ Invite your network to join: https://meetups.mulesoft.com/surat/
Feedback:
○ Fill out the survey feedback and suggest topics for upcoming events
○ Contact MuleSoft at meetups@mulesoft.com for ways to improve the program
○ Reach out to either Jitendra Bafna or Nitish Jainto suggest topics for next Meetup
What’s next?