Note: In all API calls, replace the % and example values between the % signs with your own variable values.
Get AccountContactAffiliation
Replace %id% with the id of the AccountContactAffiliation that you want to retrieve, %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by authentication process.
- Description: Retrieve AccountContactAffiliation by id.
- URL structure: http://crmme_url/index.php/AccountContactAffiliations/AccountContactAffiliation/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 AccountContactAffiliation 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/AccountContactAffiliations/AccountContactAffiliation/api/read/' . $id, 'GET', $headers); // Decode json data $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { $accountContactAffiliation = $response['data']; //Do something with AccountContactAffiliation } else { // Error, for example if we provided invalid AccountContactAffiliation id $errors = $response['errors']; // Do something with errors }
- Return:
Data contains AccountContactAffiliation info.
{ "status":"SUCCESS", "data":{ "id":1, "createdDateTime":"2014-01-24 10:45:45", "modifiedDateTime":"2014-01-24 10:45:45", "createdByUser":{ "id":1, "username":"super" }, "modifiedByUser":{ "id":1, "username":"super" }, "primary":"0", "role":null, "account":{ "id":1 }, "contact":{ "id":1 } }, "message":null, "errors":null }
Delete AccountContactAffiliation
Replace %id% with the id of AccountContactAffiliation that you want to delete, %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by authentication process.
- Description: Delete AccountContactAffiliation by id.
- URL structure: http://crmme_url/index.php/AccountContactAffiliations/AccountContactAffiliation/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 AccountContactAffiliation 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/AccountContactAffiliations/AccountContactAffiliation/api/delete/' . $id, 'DELETE', $headers); $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { // Inform user that AccountContactAffiliation is deleted } else { // Error, for example if we provided invalid AccountContactAffiliation id $errors = $response['errors']; // Do something with errors }
- Return:
{ "status":"SUCCESS", "data":null, "message":null, "errors":null }
Create New AccountContactAffiliation
Replace %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by authentication process.
- Description: Create new AccountContactAffiliation
- URL structure: http://crmme_url/index.php/AccountContactAffiliations/AccountContactAffiliation/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 ( [account] => Array ( [id] => 4 ) [contact] => Array ( [id] => 5 ) )
- 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['account']['id'] = $account->id; $data['contact']['id'] = $contact->id; $response = ApiRestHelper::createApiCall('http://crmme_url/index.php/AccountContactAffiliations/AccountContactAffiliation/api/create/', 'POST', $headers, array('data' => $data)); $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { $AccountContactAffiliation = $response['data']; //Do something with AccountContactAffiliation data } else { // Error $errors = $response['errors']; // Do something with errors, show them to user }
- Return:
{
"status":"SUCCESS",
"data":{
"id":1,
"createdDateTime":"2014-01-24 10:45:45",
"modifiedDateTime":"2014-01-24 10:45:45",
"createdByUser":{
"id":1,
"username":"super"
},
"modifiedByUser":{
"id":1,
"username":"super"
},
"primary":"0",
"role":null,
"account":{
"id":4
},
"contact":{
"id":5
}
},
"message":null,
"errors":null
}
Update existing AccountContactAffiliation
Replace %id% with the id of the AccountContactAffiliation that you want to update, %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by authentication process.
- Description: Update existing AccountContactAffiliation by id
- URL structure: http://crmme_url/index.php/AccountContactAffiliations/AccountContactAffiliation/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['contact']['id'] = 6;
- PHP sample:
$id = 1; // Change this value to AccountContactAffiliation 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 AccountContactAffiliation secondary account
$data['secondaryAccount']['id'] = 5;
$response = ApiRestHelper::createApiCall('http://crmme_url/index.php/AccountContactAffiliations/AccountContactAffiliation/api/update/' . $id, 'PUT', $headers, array('data' => $data));
$response = json_decode($response, true);
if ($response['status'] == 'SUCCESS')
{
$accountContactAffiliation = $response['data'];
//Do something with AccountContactAffiliation data
}
else
{
// Error, for example if we provided invalid AccountContactAffiliation id
$errors = $response['errors'];
// Do something with errors
}
- Return:
Code will return complete updated AccountContactAffiliation info.
{
"status":"SUCCESS",
"data":{
"id":1,
"createdDateTime":"2014-01-24 10:45:45",
"modifiedDateTime":"2014-01-24 10:45:45",
"createdByUser":{
"id":1,
"username":"super"
},
"modifiedByUser":{
"id":1,
"username":"super"
},
"primary":"0",
"role":null,
"account":{
"id":4
},
"contact":{
"id":6
}
},
"message":null,
"errors":null
}
Get Affiliated Accounts and Contacts(Search For AccountContactAffiliation)
Replace %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by authentication process.
- Description: Search AccountContactAffiliation
- URL structure: http://crmme_url/index.php/AccountContactAffiliations/AccountContactAffiliation/api/search/filter/
- Method: POST, GET (accept both methods)
- HTTP header parameters:
Accept: application/json
ZURMO_API_REQUEST_TYPE: REST
ZURMO_SESSION_ID: %sessionId%
ZURMO_TOKEN: %token% - Query parameters:
Array ( [search] => Array ( [modelClassName] => AccountContactAffiliation [searchAttributeData] => Array ( [clauses] => Array ( [1] => Array ( [attributeName] => account [relatedAttributeName] => id [operatorType] => equals [value] => 9 ) ) [structure] => 1 ) ) [pagination] => Array ( [page] => 1 [pageSize] => 5 ) [sort] => id asc )
- PHP sample:
$authenticationData = login('super','super'); //Add code to check if user is logged successfully // Code below will return all AccountContactAffiliation models which contain account id specified // in search attributes. $headers = array( 'Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST', ); $data = array( 'search' => array( 'modelClassName' => 'AccountContactAffiliation', 'searchAttributeData' => array( 'clauses' => array( 1 => array( 'attributeName' => 'account', 'relatedAttributeName' => 'id', 'operatorType' => 'equals', 'value' => $account->id, ), ), 'structure' => '1', ), ), 'pagination' => array( 'page' => 1, 'pageSize' => 5, ), 'sort' => 'id asc', ); // Get first page of results $response = ApiRestTestHelper::createApiCall('http://crmme_url/index.php/AccountContactAffiliations/AccountContactAffiliation/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 AccountContactAffiliation } } else { // There are no AccountContactAffiliation } } else { $errors = $response['errors']; // Do something with errors }
- Return:
{
"status":"SUCCESS",
"data":{
"totalCount":2,
"currentPage":1,
"items":[
{
"id":6,
"createdDateTime":"2014-01-24 10:54:23",
"modifiedDateTime":"2014-01-24 10:54:24",
"createdByUser":{
"id":1,
"username":"super"
},
"modifiedByUser":{
"id":1,
"username":"super"
},
"primary":"0",
"role":null,
"account":{
"id":5
},
"contact":{
"id":7
}
},
{
"id":7,
"createdDateTime":"2014-01-24 10:54:25",
"modifiedDateTime":"2014-01-24 10:54:25",
"createdByUser":{
"id":1,
"username":"super"
},
"modifiedByUser":{
"id":1,
"username":"super"
},
"primary":"0",
"role":null,
"account":{
"id":6
},
"contact":{
"id":7
}
}
]
},
"message":null,
"errors":null
}
List AccountContactAffiliation Attributes
Replace %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by authentication process.
- Description: List all AccountContactAffiliation attributes.
- URL structure: http://crmme_url/index.php/AccountContactAffiliations/AccountContactAffiliation/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/AccountContactAffiliations/AccountContactAffiliation/api/listAttributes', 'GET', $headers); // Decode json data $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { $accountAttributes = $response['data']; //Do something with AccountContactAffiliation attributes } else { // Error $errors = $response['errors']; // Do something with errors }
- Return:
Data contains AccountContactAffiliation attributes info. Below is just excerpt from response.
{ "status":"SUCCESS", "data":{ "items":{ "createdByUser":{ "attributeLabel":"Created By User", "elementType":"User", "isRequired":false, "isReadOnly":true, "isAudited":true, "customFieldName":null }, ... ... ... } }, "message":null, "errors":null }
Comments