function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
API User 69API User 69 

Post comment to salesforce case using Rest Api

I am trying to integrate Salesforce with some external application. Using Postman I am trying out the API to post comment to Salesforce case. Can someone guide me which API to use?
 
Karthik KKarthik K
Here is a sample url 

/services/data/v34.0/sobjects/Case/<<your case id goes here>>/CaseComments
API User 69API User 69
Hi Karthik,
Thanks for the quick reply. 

I already tried this API : 
content:
{
   "body":{
      "messageSegments":[
         {
            "type":"Text",
            "text":"test comments"
         }
      ]
   }
}

Error: [{"errorCode":"METHOD_NOT_ALLOWED","message":"HTTP Method 'POST' not allowed. Allowed are HEAD,GET"}]



 
 
Nanda Kumar MangatiNanda Kumar Mangati
Is there a way to add an update to Case? Like adding a new text post.
Anthony VargasAnthony Vargas
You can edit a specific case comment with the following;

PATCH: https://yourcompanyurl/services/data/v48.0/sobjects/CaseComment/case_comment_ID_goes_here

Body: 
{
    "CommentBody":"Edit Comment Test"
}
Anthony VargasAnthony Vargas
To create a case comment I used the following;

PATCH: https://yourcompanyurl/services/data/v48.0/sobjects/Case/case_ID_goes_here

Body:
{
    "Comments":"Test entering new case comment to case"
}