Let the platform do the work

How to Unfollow a Record

Overview

An example in bash script demonstrating how to unfollow a record using the v11 /<module>/:record/unsubscribe REST DELETE endpoint.

Unfollowing a Record

Authenticating

First, you will need to authenticate to the Sugar API. An example is shown below:

  curl -X POST -H Cache-Control:no-cache -H "Content-Type: application/json" -d '{ 
 "grant_type":"password",
 "client_id":"sugar",
 "client_secret":"",
 "username":"admin",
 "password":"password",
 "platform":"custom_api"
}' https://{site_url}/rest/v11/oauth2/token

More information on authenticating can be found in the How to Authenticate and Log Out example and /oauth2/logout endpoint documentation.

Unfollowing a Record

Next, we can unfollow a specific record using the /<module>/:record/unsubscribe endpoint.

  curl -s -X DELETE -H OAuth-Token:{access_token} -H Cache-Control:no-cache https://{site_url}/rest/v11/Accounts/e7b0d745-0a3e-c896-5358-5708113786d7/unsubscribe

More information on the unsubscribe API can be found in the /:record/unsubscribe DELETE documentation.

Response

The data received from the server is shown below:

  true