Does the Composite API Support Chatter Feed Elements?

Question:
Is there official documentation that lists the REST API resources supported by the Composite API? I attempted to use the Composite API with a request body that included two operations: a PATCH
request to update a Case
record and a POST
request to create a new Chatter feed element. However, when including the Chatter feed element API (/services/data/v59.0/chatter/feed-elements
), I received an error indicating that the resource does not exist, even though the request works fine when fired separately.
Here is the request body I used:
POST_URL: {{_endpoint}}/services/data/v59.0/composite
{
"allOrNone": true,
"compositeRequest": [
{
"method": "PATCH",
"url": "/services/data/v59.0/sobjects/Case/500al00000Ht0vH",
"referenceId": "caseUpdate",
"body": {
"Status": "Working"
}
},
{
"method": "POST",
"url": "/services/data/v59.0/chatter/feed-elements",
"referenceId": "newFeedElement",
"body": {
"body": {
"messageSegments": [
{
"type": "Text",
"text": "When should we meet for planning?"
}
]
},
"feedElementType": "FeedItem",
"subjectId": "500al00000Ht0vH" // Your valid Case ID
}
}
]
}
I got the following response:
{
"compositeResponse": [
{
"body": [
{
"errorCode": "PROCESSING_HALTED",
"message": "The transaction was rolled back since another operation in the same transaction failed."
}
],
"httpHeaders": {},
"httpStatusCode": 400,
"referenceId": "caseUpdate"
},
{
"body": [
{
"errorCode": "NOT_FOUND",
"message": "The requested resource does not exist"
}
],
"httpHeaders": {},
"httpStatusCode": 404,
"referenceId": "newFeedElement"
}
]
}
If I try to fire /services/data/v59.0/chatter/feed-elements
separately, it works fine and adds Chatter posts to the Case.
Answer:
The Composite API in Salesforce does not support all REST resources. According to the official documentation, it is designed to work with specific resources only.
Master Salesforce with expert-led Salesforce training in Mumbai—join our demo session in Mumbai, India!
the Composite API is supported for the following resources:
- All sObject resources (
/services/data/vXX.X/sobjects/
), such as creating, updating, or deleting sObjects, including handling rows by External ID. However, sObject Blob Get operations are excluded from Composite API support. - The Query resource (
/services/data/vXX.X/query/?q=soql
), which allows for executing SOQL queries. - The QueryAll resource (
/services/data/vXX.X/queryAll/?q=soql
), which includes querying for all records, including soft-deleted records. - The sObject Collections resource (
/services/data/vXX.X/composite/sobjects
), available from API version 43.0 onward, which allows bulk operations on sObjects.
However, the Chatter feed elements API (/services/data/v59.0/chatter/feed-elements
) is not supported by the Composite API. This is because Chatter feed elements are not included in the list of resources that can be processed as part of a composite request.
When you attempt to include the Chatter feed element API in the composite request, it results in the error “The requested resource does not exist”, because the resource is not compatible with the Composite API. To successfully post Chatter feed elements, you must call the Chatter API separately, outside of the composite request.
Conclusion:
While the Composite API is a powerful tool for performing multiple operations in a single request, it has specific limitations regarding the supported resources. Chatter feed elements and certain other APIs are not supported, so they must be handled in separate requests. It’s crucial to check the official documentation to verify which resources are compatible with the Composite API when designing your integrations.
Accelerate Your Career with Salesforce Training in Mumbai
Are you ready to elevate your career in Mumbai’s thriving Salesforce ecosystem? At CRS Info Solutions, we offer Salesforce online training that equips you with the skills to stand out. Our comprehensive program, led by experienced industry professionals, covers essential areas like Salesforce Administration, Development, and cutting-edge AI modules. With a focus on hands-on learning and real-time projects, you’ll gain practical expertise to tackle real-world challenges confidently.
Whether you’re embarking on your Salesforce journey or aiming to enhance your skill set, our tailored training programs are designed to meet your unique needs. Salesforce training in Mumbai From mastering certification requirements to acing job interviews, we provide personalized guidance, in-depth course materials, and expert strategies for success.
Join our free demo session today and take the first step toward a prosperous Salesforce career in Mumbai!!!