Note: In all API calls, replace the % and example values between the % signs with your own variable values.
Get AccountAccountAffiliation
Replace %id% with the id of the AccountAccountAffiliation that you want to retrieve, %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by authentication process.
- Description: Retrieve AccountAccountAffiliation by id.
- URL structure: http://crmme_url/index.php/accountAccountAffiliations/AccountAccountAffiliation/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 AccountAccountAffiliation 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/accountAccountAffiliations/AccountAccountAffiliation/api/read/' . $id, 'GET', $headers); // Decode json data $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { $accountAccountAffiliation = $response['data']; //Do something with AccountAccountAffiliation } else { // Error, for example if we provided invalid AccountAccountAffiliation id $errors = $response['errors']; // Do something with errors }
- Return:
Data contains AccountAccountAffiliation info.
{ "status":"SUCCESS", "data":{ "id":1, "createdDateTime":"2014-01-23 16:20:57", "modifiedDateTime":"2014-01-23 16:20:57", "createdByUser":{ "id":1, "username":"super" }, "modifiedByUser":{ "id":1, "username":"super" }, "primaryAccount":{ "id":1 }, "secondaryAccount":{ "id":2 } }, "message":null, "errors":null }
Delete AccountAccountAffiliation
Replace %id% with the id of AccountAccountAffiliation that you want to delete, %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by authentication process.
- Description: Delete AccountAccountAffiliation by id.
- URL structure: http://crmme_url/index.php/accountAccountAffiliations/AccountAccountAffiliation/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 AccountAccountAffiliation 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/accountAccountAffiliations/AccountAccountAffiliation/api/delete/' . $id, 'DELETE', $headers); $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { // Inform user that AccountAccountAffiliation is deleted } else { // Error, for example if we provided invalid AccountAccountAffiliation id $errors = $response['errors']; // Do something with errors }
- Return:
{ "status":"SUCCESS", "data":null, "message":null, "errors":null }
Create New AccountAccountAffiliation
Replace %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by authentication process.
- Description: Create new AccountAccountAffiliation
- URL structure: http://crmme_url/index.php/accountAccountAffiliations/AccountAccountAffiliation/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 ( [primaryAccount] => Array ( [id] => 4 ) [secondaryAccount] => 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['primaryAccount']['id'] = $account->id; $data['secondaryAccount']['id'] = $account2->id; $response = ApiRestHelper::createApiCall('http://crmme_url/index.php/accountAccountAffiliations/AccountAccountAffiliation/api/create/', 'POST', $headers, array('data' => $data)); $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { $accountAccountAffiliation = $response['data']; //Do something with AccountAccountAffiliation data } else { // Error $errors = $response['errors']; // Do something with errors, show them to user }
- Return:
{
"status":"SUCCESS",
"data":{
"id":3,
"createdDateTime":"2014-01-23 16:25:59",
"modifiedDateTime":"2014-01-23 16:25:59",
"createdByUser":{
"id":1,
"username":"super"
},
"modifiedByUser":{
"id":1,
"username":"super"
},
"primaryAccount":{
"id":4
},
"secondaryAccount":{
"id":5
}
},
"message":null,
"errors":null
}
Update existing AccountAccountAffiliation
Replace %id% with the id of the AccountAccountAffiliation that you want to update, %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by authentication process.
- Description: Update existing AccountAccountAffiliation by id
- URL structure: http://crmme_url/index.php/accountAccountAffiliations/AccountAccountAffiliation/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['secondaryAccount']['id'] = 5;
- PHP sample:
$id = 1; // Change this value to AccountAccountAffiliation 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 AccountAccountAffiliation secondary account
$data['secondaryAccount']['id'] = 5;
$response = ApiRestHelper::createApiCall('http://crmme_url/index.php/accountAccountAffiliations/AccountAccountAffiliation/api/update/' . $id, 'PUT', $headers, array('data' => $data));
$response = json_decode($response, true);
if ($response['status'] == 'SUCCESS')
{
$accountAccountAffiliation = $response['data'];
//Do something with AccountAccountAffiliation data
}
else
{
// Error, for example if we provided invalid AccountAccountAffiliation id
$errors = $response['errors'];
// Do something with errors
}
- Return:
Code will return complete updated AccountAccountAffiliation info.
{
"status":"SUCCESS",
"data":{
"id":3,
"createdDateTime":"2014-01-23 16:25:59",
"modifiedDateTime":"2014-01-23 16:25:59",
"createdByUser":{
"id":1,
"username":"super"
},
"modifiedByUser":{
"id":1,
"username":"super"
},
"primaryAccount":{
"id":4
},
"secondaryAccount":{
"id":5
}
},
"message":null,
"errors":null
}
Get Affiliated Accounts(Search For AccountAccountAffiliation)
Replace %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by authentication process.
- Description: Search AccountAccountAffiliation
- URL structure: http://crmme_url/index.php/accountAccountAffiliations/AccountAccountAffiliation/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] => AccountAccountAffiliation
[searchAttributeData] => Array
(
[clauses] => Array
(
[1] => Array
(
[attributeName] => primaryAccount
[relatedAttributeName] => id
[operatorType] => equals
[value] => 9
)
[2] => Array
(
[attributeName] => secondaryAccount
[relatedAttributeName] => id
[operatorType] => equals
[value] => 9
)
)
[structure] => (1 OR 2)
)
)
[pagination] => Array
(
[page] => 1
[pageSize] => 5
)
[sort] => id 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' => 'AccountAccountAffiliation',
'searchAttributeData' => array(
'clauses' => array(
1 => array(
'attributeName' => 'primaryAccount',
'relatedAttributeName' => 'id',
'operatorType' => 'equals',
'value' => $account->id,
),
2 => array(
'attributeName' => 'secondaryAccount',
'relatedAttributeName' => 'id',
'operatorType' => 'equals',
'value' => $account->id,
),
),
'structure' => '(1 OR 2)',
),
),
'pagination' => array(
'page' => 1,
'pageSize' => 5,
),
'sort' => 'id asc',
);
// Get first page of results
$response = ApiRestTestHelper::createApiCall('http://crmme_url/index.php/accountAccountAffiliations/AccountAccountAffiliation/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 AccountAccountAffiliation
}
}
else
{
// There are no AccountAccountAffiliation
}
}
else
{
$errors = $response['errors'];
// Do something with errors
}
List AccountAccountAffiliation Attributes
Replace %sessionId% and %token% with ‘sessionId’ and ‘token’ variables returned by authentication process.
- Description: List all AccountAccountAffiliation attributes.
- URL structure: http://crmme_url/index.php/accountAccountAffiliations/AccountAccountAffiliation/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/accountAccountAffiliations/AccountAccountAffiliation/api/listAttributes', 'GET', $headers); // Decode json data $response = json_decode($response, true); if ($response['status'] == 'SUCCESS') { $accountAttributes = $response['data']; //Do something with AccountAccountAffiliation attributes } else { // Error $errors = $response['errors']; // Do something with errors }
- Return:
Data contains AccountAccountAffiliation 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