What is the Chatter REST API?

The Chatter REST API

1. Enables integration with Salesforce Chatter.
2. Provides programmatic access to Chatter feeds and social data(Users, followers, files, etc.)
3. Have Build-in pagination.
4. Provides easy relationship traversal with url attribute. Sample url is "/services/data/v40.0/chatter/feed-item/0D530000001BKQ0GCA5"

Use the Chatter REST API to build

1. Social applications for mobile devices.
2. Highly interactive websites.
3. An integration from Salesforce Chatter into other applications(Faceboo, Twitter, etc.)

Example:
https://na14.salesforce.com/services/data/v40.0/chatter/users/me - Brings all the data from different objects for the user.

Requesting a News Feed
Use HTTP GET.
Example:
https://na14.salesforce.com/services/data/v40.0/chatter/feeds/news/me/feed-items/

Updating the User's status
Use HTTP POST. Use Request body along with the request.

Example:
http://na14.salesforce.com/services/data/v40/chatter/feeds/news/me/feed-items/

Request Body:
{
"body" : 
{
"messageSegments " : [
{
"type" : "Text",
"text" : "Working with Infallibletechie"
}
]
}
}

Inserting a POST with @mention
Use HTTP POST. Use Request body along with the request.

Example:
http://na14.salesforce.com/services/data/v40/chatter/feeds/news/me/feed-items/

Request Body:
{
"body" : 
{
"messageSegments " : [
{
"type" : "mention",
"text" : "005D00000001GrMq"
},
{
"type" : "Text",
"text" : "Working with Infallibletechie"
}
]
}
}

Cheers!!!

No comments:

Post a Comment