Let the platform do the work

How to Follow a Record

Overview

An example in bash script demonstrating how to follow a record using the v11 /<module>/:record/subscribe REST POST endpoint.

Following 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.

Following a Record

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

  curl -s -X POST -H OAuth-Token:{access_token} -H Cache-Control:no-cache https://{site_url}/rest/v11/Accounts/e3a59dcd-ff5e-8a78-cd7f-570811366792/subscribe

More information on the subscribe API can be found in the /<module>/:record/subscribe POST documentation.

Response

The data received from the server is shown below:

  "58f96315-9e75-6562-42e9-5705917d2cdc"