Let the platform do the work

How to Ping

Overview

An example in bash script demonstrating how to ping using the REST v11 /ping GET endpoint.

Pinging

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.

Pinging

Once we have authenticated, we can now ping the system as shown below.

  curl -s -X GET -H OAuth-Token:{access_token} -H Cache-Control:no-cache https://{site_url}/rest/v11/ping

More information on pinging can be found in the /ping documentation.

Response

  "pong"