Note: In all API calls, replace the % and example values between the % signs with your own variable values.
Get Meeting
Replace %id% with the id of the meeting that you want to retrieve, %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by the authentication process.
- Description: Retrieve meeting by id.
- URL structure: http://crmme_url/index.php/meetings/meeting/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 meeting 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/meetings/meeting/api/read/' . $id, 'GET', $headers); // Decode json data $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { $meeting = $response['data']; //Do something with meeting data } else { // Error, for example if we provided invalid meeting id $errors = $response['errors']; // Do something with errors }
- Return:
Data contains meeting info.
{ "status":"SUCCESS", "data":{ "id":1, "createdDateTime":"2012-05-08 08:31:18", "modifiedDateTime":"2012-05-08 08:31:18", "createdByUser":{ "id":1, "username":"super" }, "modifiedByUser":{ "id":1, "username":"super" }, "owner":{ "id":1, "username":"super" }, "latestDateTime":"2012-05-08 11:17:58", "description":"my test description", "endDateTime":"2012-05-08 11:34:38", "location":"my location", "name":"First Meeting", "startDateTime":"2012-05-08 11:17:58", "category":{ "id":2, "value":"Call" } }, "message":null, "errors":null }
Delete Meeting
Replace %id% with the id of meeting that you want to delete, %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by the authentication process.
- Description: Delete meeting by id.
- URL structure: http://crmme_url/index.php/meetings/meeting/api/delete/%id%
- Method: DELETE
- HTTP header parameters:
Accept: application/json
ZURMO_API_REQUEST_TYPE: REST
ZURMO_SESSION_ID: %sessionId%
ZURMO_TOKEN: %token% - Parameters: None
- PHP sample:
$id = 1; // Change this value to meeting id that you want to delete $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/meetings/meeting/api/delete/' . $id, 'DELETE', $headers); $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { // Inform user that meeting is deleted } else { // Error, for example if we provided invalid meeting id $errors = $response['errors']; // Do something with errors }
- Return:
{ "status":"SUCCESS", "data":null, "message":null, "errors":null }
Create New Meeting
Replace %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by the authentication process.
- Description: Create new meeting
- URL structure: http://crmme_url/index.php/meetings/meeting/api/create/
- Method: POST
- HTTP header parameters:
Accept: application/json
ZURMO_API_REQUEST_TYPE: REST
ZURMO_SESSION_ID: %sessionId%
ZURMO_TOKEN: %token% - Parameters:
$data = Array ( [name] => Michael Meeting [startDateTime] => 2012-05-08 11:21:36 [endDateTime] => 2012-05-08 11:38:16 [location] => Office [description] => Description [category] => Array ( [value] => Call ) [modelRelations] => Array ( [activityItems] => Array ( [0] => Array ( [action] => add [modelId] => 4 [modelClassName] => Contact ) ) ) )
- 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', ); $data = Array ( 'name' => 'Michael Meeting', 'startDateTime' => '2012-05-08 11:21:36', 'endDateTime' => '2012-05-08 11:38:16', 'location' => 'Office', 'description' => 'Description', 'category' => Array ( 'value' => 'Call' ), // Attach meeting to contact 'activityItems' => array( array( 'action' => 'add', 'modelId' => $contact->id, // Replace this with contact Id (or account/opportunity id to which you want to attach meeting) 'modelClassName' => 'Contact' // Instead 'Contact' you can attach meeting to 'Account', 'Opportunity' ), ), ); $response = ApiRestHelper::createApiCall('http://crmme_url/index.php/meetings/meeting/api/create/', 'POST', $headers, array('data' => $data)); $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { $meeting = $response['data']; //Do something with meeting data } else { // Error $errors = $response['errors']; // Do something with errors, show them to user }
- Return:
{ "status":"SUCCESS", "data":{ "id":2, "description":"Description", "endDateTime":"2012-05-08 11:41:05", "location":"Office", "name":"Michael Meeting", "startDateTime":"2012-05-08 11:24:25", "category":{ "id":3, "value":"Call" }, "latestDateTime":"2012-05-08 11:24:25", "owner":{ "id":1, "username":"super" }, "createdDateTime":"2012-05-08 08:37:45", "modifiedDateTime":"2012-05-08 08:37:45", "createdByUser":{ "id":1, "username":"super" }, "modifiedByUser":{ "id":1, "username":"super" } }, "message":null, "errors":null }
Update existing meeting
Replace %id% with the id of the meeting that you want to update, %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by the authentication process.
- Description: Update existing meeting by id
- URL structure: http://crmme_url/index.php/meetings/meeting/api/update/%id%
- Method: PUT
- HTTP header parameters:
Accept: application/json
ZURMO_API_REQUEST_TYPE: REST
ZURMO_SESSION_ID: %sessionId%
ZURMO_TOKEN: %token% - Parameters:
All parameters are optional, so you can only provide properties that you want to update.
For example:
$data = Array ( [description] => Some new description [modelRelations] => Array ( [activityItems] => Array ( [0] => Array ( [action] => add [modelId] => 5 [modelClassName] => Contact ) ) ) )
- PHP sample:
$id = 1; // Change this value to meeting id that you want to change $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', ); // Change meeting description $data['description'] = "Some new description"; $data['modelRelations'] = array( 'activityItems' => array( array( 'action' => 'add', // Another option is to delete relationship, and it that case replace 'add' with 'remove' 'modelId' => $contact->id, 'modelClassName' => 'Contact' ), ), ); $response = ApiRestHelper::createApiCall('http://crmme_url/index.php/meetings/meeting/api/update/' . $id, 'PUT', $headers, array('data' => $data)); $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { $meeting = $response['data']; //Do something with meeting data } else { // Error, for example if we provided invalid meeting id $errors = $response['errors']; // Do something with errors }
- Return:
Code will return complete updated meeting info.
{ "status":"SUCCESS", "data":{ "id":2, "description":"Some new description", "endDateTime":"2012-05-08 11:41:05", "location":"Office", "name":"Michael Meeting", "startDateTime":"2012-05-08 11:24:25", "category":{ "id":3, "value":"Call" }, "latestDateTime":"2012-05-08 11:24:25", "owner":{ "id":1, "username":"super" }, "createdDateTime":"2012-05-08 08:37:45", "modifiedDateTime":"2012-05-08 08:37:45", "createdByUser":{ "id":1, "username":"super" }, "modifiedByUser":{ "id":1, "username":"super" } }, "message":null, "errors":null }
Search meetings
Replace %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by the authentication process.
- Description: Search meetings
- URL structure: http://crmme_url/index.php/meetings/meeting/api/list/filter/%searchFilter%
- Method: GET
- HTTP header parameters:
Accept: application/json
ZURMO_API_REQUEST_TYPE: REST
ZURMO_SESSION_ID: %sessionId%
ZURMO_TOKEN: %token% - Query parameters:
$searchFilter = Array ( [pagination] => Array ( [page] => 1 [pageSize] => 3 ) [search] => Array ( [name] => Michael ) [sort] => name.desc )
- 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', ); $searchParams = array( 'pagination' => array( 'page' => 1, 'pageSize' => 3, ), 'search' => array( 'name' => 'First Meeting', ), 'sort' => 'name.desc', ); // Get first page of results $searchParamsQuery = http_build_query($searchParams); $response = ApiRestTestHelper::createApiCall('http://crmme_url/index.php/meetings/meeting/api/list/filter/' . $searchParamsQuery, 'GET', $headers); $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { // Do something with results if ($response['data']['totalCount'] > 0) { foreach ($response['data']['items'] as $item) { // Print meetings } } else { // There are no meetings } } else { $errors = $response['errors']; // Do something with errors } // Now get second page (you might wanted to check if there are results on second page first) $searchParams = array( 'pagination' => array( 'page' => 2, 'pageSize' => 3, ), 'search' => array( 'name' => 'First Meeting', ), 'sort' => 'name.desc', ); // Get second page of results $searchParamsQuery = http_build_query($searchParams); $response = ApiRestTestHelper::createApiCall('http://crmme_url/index.php/meetings/meeting/api/list/filter/' . $searchParamsQuery, 'GET', $headers); $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { // Do something with results if ($response['data']['totalCount'] > 0) { foreach ($response['data']['items'] as $item) { // Print meetings } } else { // There are no meetings } } else { $errors = $response['errors']; // Do something with errors }
- Return:
{ "status":"SUCCESS", "data":{ "totalCount":"5", "currentPage":2, "items":[ { "id":3, "createdDateTime":"2012-05-08 08:46:58", "modifiedDateTime":"2012-05-08 08:46:58", "createdByUser":{ "id":1, "username":"super" }, "modifiedByUser":{ "id":1, "username":"super" }, "owner":{ "id":1, "username":"super" }, "latestDateTime":"2012-05-08 11:33:38", "description":"my test description", "endDateTime":"2012-05-08 11:50:18", "location":"my location", "name":"First Meeting", "startDateTime":"2012-05-08 11:33:38", "category":{ "id":9, "value":"Call" } }, { "id":7, "createdDateTime":"2012-05-08 08:46:59", "modifiedDateTime":"2012-05-08 08:46:59", "createdByUser":{ "id":1, "username":"super" }, "modifiedByUser":{ "id":1, "username":"super" }, "owner":{ "id":1, "username":"super" }, "latestDateTime":"2012-05-08 11:33:39", "description":"my test description", "endDateTime":"2012-05-08 11:50:19", "location":"my location", "name":"Fifth Meeting", "startDateTime":"2012-05-08 11:33:39", "category":{ "id":13, "value":"Call" } } ] }, "message":null, "errors":null }
Meetings Dynamic Search
Replace %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by the authentication process.
- Description: Search meetings
- URL structure: http://crmme_url/index.php/meetings/meeting/api/list/filter/
- Method: GET, POST
- HTTP header parameters:
Accept: application/json
ZURMO_API_REQUEST_TYPE: REST
ZURMO_SESSION_ID: %sessionId%
ZURMO_TOKEN: %token% - Query parameters:
$data = Array ( [dynamicSearch] => Array ( [dynamicClauses] => Array ( [0] => Array ( [attributeIndexOrDerivedType] => owner [structurePosition] => 1 [owner] => Array ( [id] => 3 ) ) [1] => Array ( [attributeIndexOrDerivedType] => name [structurePosition] => 2 [name] => Fi ) [2] => Array ( [attributeIndexOrDerivedType] => name [structurePosition] => 3 [name] => Se ) ) [dynamicStructure] => 1 AND (2 OR 3) ) [pagination] => Array ( [page] => 1 [pageSize] => 2 ) [sort] => name.asc )
- 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', ); $data = array( 'dynamicSearch' => array( 'dynamicClauses' => array( array( 'attributeIndexOrDerivedType' => 'owner', 'structurePosition' => 1, 'owner' => array( 'id' => Yii::app()->user->userModel->id, ), ), array( 'attributeIndexOrDerivedType' => 'name', 'structurePosition' => 2, 'name' => 'Fi', ), array( 'attributeIndexOrDerivedType' => 'name', 'structurePosition' => 3, 'name' => 'Se', ), ), 'dynamicStructure' => '1 AND (2 OR 3)', ), 'pagination' => array( 'page' => 1, 'pageSize' => 2, ), 'sort' => 'name.asc', ); // Get first page of results $response = ApiRestTestHelper::createApiCall('http://crmme_url/index.php/meetings/meeting/api/list/filter/', 'POST', $headers, array('data' => $data)); $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { // Do something with results if ($response['data']['totalCount'] > 0) { foreach ($response['data']['items'] as $item) { // Print meetings } } else { // There are no meetings } } else { $errors = $response['errors']; // Do something with errors }
- Return:
{ "status":"SUCCESS", "data":{ "totalCount":"5", "currentPage":2, "items":[ { "id":3, "createdDateTime":"2012-05-08 08:46:58", "modifiedDateTime":"2012-05-08 08:46:58", "createdByUser":{ "id":1, "username":"super" }, "modifiedByUser":{ "id":1, "username":"super" }, "owner":{ "id":1, "username":"super" }, "latestDateTime":"2012-05-08 11:33:38", "description":"my test description", "endDateTime":"2012-05-08 11:50:18", "location":"my location", "name":"First Meeting", "startDateTime":"2012-05-08 11:33:38", "category":{ "id":9, "value":"Call" } }, { "id":7, "createdDateTime":"2012-05-08 08:46:59", "modifiedDateTime":"2012-05-08 08:46:59", "createdByUser":{ "id":1, "username":"super" }, "modifiedByUser":{ "id":1, "username":"super" }, "owner":{ "id":1, "username":"super" }, "latestDateTime":"2012-05-08 11:33:39", "description":"my test description", "endDateTime":"2012-05-08 11:50:19", "location":"my location", "name":"Fifth Meeting", "startDateTime":"2012-05-08 11:33:39", "category":{ "id":13, "value":"Call" } } ] }, "message":null, "errors":null }
Meetings Improved Search
Replace %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by the authentication process.
- Description: Search meetings – improved
- URL structure: http://crmme_url/index.php/meetings/meeting/api/search/filter/
- Method: GET, POST
- HTTP header parameters:
Accept: application/json
ZURMO_API_REQUEST_TYPE: REST
ZURMO_SESSION_ID: %sessionId%
ZURMO_TOKEN: %token% - Query parameters:
$data = Array ( [search] => Array ( [modelClassName] => Meeting [searchAttributeData] => Array ( [clauses] => Array ( [1] => Array ( [attributeName] => owner [relatedAttributeName] => id [operatorType] => equals [value] => 1 ) [2] => Array ( [attributeName] => name [operatorType] => startsWith [value] => Fi ) [3] => Array ( [attributeName] => name [operatorType] => startsWith [value] => Se ) ) [structure] => 1 AND (2 OR 3) ) ) [pagination] => Array ( [page] => 1 [pageSize] => 2 ) [sort] => name asc )
- 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', ); $data = array( 'search' => array( 'modelClassName' => 'Meeting', 'searchAttributeData' => array( 'clauses' => array( 1 => array( 'attributeName' => 'owner', 'relatedAttributeName' => 'id', 'operatorType' => 'equals', 'value' => $userId, ), 2 => array( 'attributeName' => 'name', 'operatorType' => 'startsWith', 'value' => 'Fi' ), 3 => array( 'attributeName' => 'name', 'operatorType' => 'startsWith', 'value' => 'Se' ), ), 'structure' => '1 AND (2 OR 3)', ), ), 'pagination' => array( 'page' => 1, 'pageSize' => 2, ), 'sort' => 'name asc', ); // Get first page of results $response = ApiRestTestHelper::createApiCall('http://crmme_url/index.php/meetings/meeting/api/search/filter/', 'POST', $headers, array('data' => $data)); $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { // Do something with results if ($response['data']['totalCount'] > 0) { foreach ($response['data']['items'] as $item) { // Print meetings } } else { // There are no meetings } } else { $errors = $response['errors']; // Do something with errors }
- Return:
{ "status":"SUCCESS", "data":{ "totalCount":"5", "currentPage":2, "items":[ { "id":3, "createdDateTime":"2012-05-08 08:46:58", "modifiedDateTime":"2012-05-08 08:46:58", "createdByUser":{ "id":1, "username":"super" }, "modifiedByUser":{ "id":1, "username":"super" }, "owner":{ "id":1, "username":"super" }, "latestDateTime":"2012-05-08 11:33:38", "description":"my test description", "endDateTime":"2012-05-08 11:50:18", "location":"my location", "name":"First Meeting", "startDateTime":"2012-05-08 11:33:38", "category":{ "id":9, "value":"Call" } }, { "id":7, "createdDateTime":"2012-05-08 08:46:59", "modifiedDateTime":"2012-05-08 08:46:59", "createdByUser":{ "id":1, "username":"super" }, "modifiedByUser":{ "id":1, "username":"super" }, "owner":{ "id":1, "username":"super" }, "latestDateTime":"2012-05-08 11:33:39", "description":"my test description", "endDateTime":"2012-05-08 11:50:19", "location":"my location", "name":"Fifth Meeting", "startDateTime":"2012-05-08 11:33:39", "category":{ "id":13, "value":"Call" } } ] }, "message":null, "errors":null }
List Meeting Attributes
Replace %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by authentication process.
- Description: List contact attributes.
- URL structure: http://zurmo_url/index.php/meetings/meeting/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://zurmo_url/index.php/meetings/meeting/api/listAttributes', 'GET', $headers); // Decode json data $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { $meetingAttributes = $response['data']; //Do something with meeting attributes } else { // Error $errors = $response['errors']; // Do something with errors }
- Return:
Data contains meeting attributes info.
Comments