Note: In all API calls, replace the % and example values between the % signs with your own variable values.
Get Group
Replace %id% with the id of the group that you want to retrieve, %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by the authentication process.
- Description: Retrieve group by id.
- URL structure: http://crmme_url/index.php/zurmo/group/api/read/%id%
- Method: GET
- HTTP header parameters:
Accept: application/json
ZURMO_API_REQUEST_TYPE: REST
ZURMO_SESSION_ID: %sessionId%
ZURMO_TOKEN: %token% - Parameters: None
- PHP sample:
$authenticationData = login('super','super'); //Add code to check if user is logged successfully $id = 1; // Change this with value of group id $headers = array( 'Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST', ); $response = ApiRestHelper::createApiCall('http://crmme_url/index.php/zurmo/group/api/read/' . $id, 'GET', $headers); // Decode json data $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { $group = $response['data']; //Do something with group data } else { // Error, for example if we provided invalid group id $errors = $response['errors']; // Do something with errors }
- Return:
Data contains group info.
{ "status":"SUCCESS", "data":{ "id":2, "createdDateTime":"2012-05-08 11:30:04", "modifiedDateTime":"2012-05-08 11:30:04", "createdByUser":{ "id":1, "username":"super" }, "modifiedByUser":{ "id":1, "username":"super" }, "name":"myGroup" }, "message":null, "errors":null }
Get All Groups
Replace %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by the authentication process.
- Description: Retrieve all groups.
- URL structure: http://crmme_url/index.php/zurmo/group/api/list/
- Method: GET
- HTTP header parameters:
Accept: application/json
ZURMO_API_REQUEST_TYPE: REST
ZURMO_SESSION_ID: %sessionId%
ZURMO_TOKEN: %token% - Parameters: None
- PHP sample:
$authenticationData = login('super','super'); //Add code to check if user is logged successfully $headers = array( 'Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST', ); $response = ApiRestHelper::createApiCall('http://crmme_url/index.php/zurmo/group/api/list/', 'GET', $headers); // Decode json data $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { $groups = $response['data']; //Do something with groups } else { // Error $errors = $response['errors']; // Do something with errors }
- Return:
Data contains groups.
List Group Attributes
Replace %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by authentication process.
- Description: List group attributes.
- URL structure: http://crmme_url/index.php/zurmo/group/api/listAttributes
- Method: GET
- HTTP header parameters:
Accept: application/json
ZURMO_API_REQUEST_TYPE: REST
ZURMO_SESSION_ID: %sessionId%
ZURMO_TOKEN: %token% - Parameters: None
- PHP sample
$authenticationData = login('super','super'); //Add code to check if user is logged successfully $headers = array( 'Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST', ); $response = ApiRestHelper::createApiCall('http://crmme_url/index.php/zurmo/group/api/listAttributes', 'GET', $headers); // Decode json data $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { $groupAttributes = $response['data']; //Do something with group attributes } else { // Error $errors = $response['errors']; // Do something with errors }
- Return:
Data contains group attributes info.
Comments