-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from MichaelJ2324/2.0
2.0.Beta.1
- Loading branch information
Showing
161 changed files
with
3,229 additions
and
5,962 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
*.iml | ||
.idea/ | ||
vendor/ | ||
|
||
composer.lock | ||
coverage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
require_once 'include.php'; | ||
|
||
$SugarAPI = new \Sugarcrm\REST\Client\Sugar7API($server,$credentials); | ||
try{ | ||
$SugarAPI->login(); | ||
echo "Logged In: <pre>"; | ||
print_r($SugarAPI->getAuth()->getToken()->access_token); | ||
echo "</pre>"; | ||
$Account = $SugarAPI->module('Accounts')->set("name","Audit Log Test"); | ||
$Account->save(); | ||
echo "<pre>Created Account: {$Account['id']}</pre><br>"; | ||
$Account->set('phone_office','555-555-5555'); | ||
$Account['name'] = 'Audit Log Test - Updated'; | ||
$Account['assigned_user_id'] = 'seed_max_id'; | ||
$Account->save(); | ||
echo "<pre> Account Updated: <br>".print_r($Account->asArray(),true)."</pre><br>"; | ||
$Account->audit(); | ||
echo "<pre> Audit Log:".print_r($Account->getResponse()->getBody(),true)."</pre><br>"; | ||
}catch (Exception $ex){ | ||
echo "<pre>"; | ||
//print_r($SugarAPI); | ||
echo "</pre>"; | ||
print $ex->getMessage(); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,29 @@ | ||
<?php | ||
|
||
require_once 'include.php'; | ||
|
||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
|
||
$SugarAPI = new \Sugarcrm\REST\Client\Sugar7API($server,$credentials); | ||
try{ | ||
$SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Ent/7700/',array('username' => 'admin','password'=>'asdf')); | ||
$SugarAPI->login(); | ||
$EP = $SugarAPI->filterRecords('Accounts'); | ||
$response = $EP->execute()->getResponse(); | ||
print_r($EP->getRequest()); | ||
if ($response->getStatus()=='200'){ | ||
$recordList = $response->getBody(false); | ||
$max=count($recordList->records); | ||
echo "found $max records from Filter Records request. <br>"; | ||
$number = rand(0,$max); | ||
$randomRecord = $recordList->records[$number]; | ||
echo "Choose random record #$number, with ID: ".$randomRecord->id." <br>"; | ||
|
||
$getRecord = $SugarAPI->getRecord('Accounts',$randomRecord->id)->execute(array( | ||
'fields' => 'name' | ||
)); | ||
$response = $getRecord->getResponse(); | ||
if ($response->getStatus()=='200'){ | ||
echo "Retrieved Record <br>"; | ||
$randomRecord = $getRecord->getResponse()->getBody(false); | ||
$randomRecord->name = 'Updated Record Name'; | ||
$updateRecord = $SugarAPI->updateRecord('Accounts', $randomRecord->id)->execute($randomRecord); | ||
$response = $updateRecord->getResponse(); | ||
if ($response->getStatus()=='200'){ | ||
$randomRecord = $updateRecord->getResponse()->getBody(false); | ||
echo "Updated Record <br>"; | ||
print_r($randomRecord); | ||
|
||
$deleteRecord = $SugarAPI->deleteRecord('Accounts', $randomRecord->id)->execute(); | ||
$response = $deleteRecord->getResponse(); | ||
if ($response->getStatus()=='200'){ | ||
$response = $deleteRecord->getResponse()->getBody(); | ||
echo "Deleted Record <br>"; | ||
print_r($response); | ||
}else{ | ||
echo "Failed to Delete record<br>"; | ||
echo "Response: ".$response->getStatus()."<br>"; | ||
print_r($response->getBody()); | ||
} | ||
}else{ | ||
print_r($updateRecord->getRequest()); | ||
echo "Failed to Update record<br>"; | ||
echo "Response: ".$response->getStatus()."<br>"; | ||
print_r($response->getBody()); | ||
} | ||
}else{ | ||
echo "Failed to retrieve record<br>"; | ||
echo "Response: ".$response->getStatus()."<br>"; | ||
print_r($response->getBody()); | ||
} | ||
}else{ | ||
echo "Response: ".$response->getStatus(); | ||
print_r($response->getBody()); | ||
} | ||
}catch (\SugarAPI\SDK\Exception\AuthenticationException $ex){ | ||
echo "Credentails:<pre>"; | ||
print_r($SugarAPI->getCredentials()); | ||
echo "</pre> Error Message: "; | ||
echo "<pre>"; | ||
print_r($SugarAPI->getAuth()->getToken()->access_token); | ||
echo "</pre>"; | ||
$Account = $SugarAPI->module('Accounts')->set("name","Test")->set("phone_office","555-555-5555"); | ||
echo "<pre> Account:".print_r($Account->asArray(),true)."</pre><br>"; | ||
$Account->save(); | ||
echo "<pre> Saved Account ID: {$Account['id']}</pre><br>"; | ||
$Account->set('employees','100'); | ||
$Account['shipping_address_city'] = 'Indianapolis'; | ||
$Account->save(); | ||
echo "<pre> Account Updated: <br>".print_r($Account->asArray(),true)."</pre>"; | ||
$Account2 = $SugarAPI->module('Accounts',$Account['id']); | ||
$Account2->retrieve(); | ||
echo "<pre> Account2:".print_r($Account2->asArray(),true)."</pre><br>"; | ||
$Account2->delete(); | ||
echo "Account Deleted. <br><pre>".print_r($Account2->getResponse(),true)."</pre>"; | ||
}catch (Exception $ex){ | ||
echo "<pre>"; | ||
//print_r($SugarAPI); | ||
echo "</pre>"; | ||
print $ex->getMessage(); | ||
}catch (\SugarAPI\SDK\Exception\SDKException $ex){ | ||
echo $ex->__toString(); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
require_once 'include.php'; | ||
|
||
$SugarAPI = new \Sugarcrm\REST\Client\Sugar7API($server,$credentials); | ||
|
||
try{ | ||
$SugarAPI->login(); | ||
echo "Logged In: <pre>"; | ||
print_r($SugarAPI->getAuth()->getToken()->access_token); | ||
echo "</pre>"; | ||
$Account = $SugarAPI->module('Accounts')->set("name","Favorite Test"); | ||
$Account->save(); | ||
echo "<pre> Account Created: {$Account['id']}</pre><br>"; | ||
$Account->favorite(); | ||
echo "<pre> Account added to Favorites: <br>".print_r($Account,true)."</pre>"; | ||
}catch (Exception $ex){ | ||
echo "<pre>"; | ||
//print_r($SugarAPI); | ||
echo "</pre>"; | ||
print $ex->getMessage(); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
require_once 'include.php'; | ||
|
||
$SugarAPI = new \Sugarcrm\REST\Client\Sugar7API($server,$credentials); | ||
try{ | ||
$SugarAPI->login(); | ||
echo "<pre>"; | ||
print_r($SugarAPI->getAuth()->getToken()->access_token); | ||
echo "</pre>"; | ||
$Accounts = $SugarAPI->list('Accounts'); | ||
$Accounts->filter()->and() | ||
->or() | ||
->starts('name','s') | ||
->contains('name','test') | ||
->endOr() | ||
->equals('assigned_user_id','seed_max_id') | ||
->endAnd(); | ||
echo "<pre> Filter Accounts that are assigned to User Max, and that either start with an S or contain 'test' in the name: ".var_dump($Accounts->filter()->compile())."</pre><br>"; | ||
$Accounts->filter()->execute(); | ||
echo "<pre> Response:".print_r($Accounts->getResponse()->getBody(),true)."</pre><br>"; | ||
}catch (Exception $ex){ | ||
echo "<pre>"; | ||
//print_r($SugarAPI); | ||
echo "</pre>"; | ||
print $ex->getMessage(); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
require_once 'include.php'; | ||
|
||
$SugarAPI = new \Sugarcrm\REST\Client\Sugar7API($server,$credentials); | ||
try{ | ||
$SugarAPI->login(); | ||
echo "<pre>"; | ||
print_r($SugarAPI->getAuth()->getToken()->access_token); | ||
echo "</pre>"; | ||
$Account = $SugarAPI->module('Accounts')->set("name","Relate Records Test"); | ||
$Account->save(); | ||
echo "<pre> Saved Account ID: {$Account['id']}</pre><br>"; | ||
$Opportunity = $SugarAPI->module('Opportunities'); | ||
$Opportunity['name'] = 'Test Opportunity'; | ||
$Opportunity['description'] = 'This opportunity was created via the SugarCRM REST API Client v2 to test creating relationships.'; | ||
$Opportunity->save(); | ||
echo "<pre> Opportunity Created: <br>".print_r($Opportunity->asArray(),true)."</pre>"; | ||
$Account->relate('opportunities',$Opportunity['id']); | ||
echo "<pre> Relationship Created:".print_r($Account->getResponse(),true)."</pre><br>"; | ||
}catch (Exception $ex){ | ||
echo "<pre>"; | ||
//print_r($SugarAPI); | ||
echo "</pre>"; | ||
print $ex->getMessage(); | ||
} |
Oops, something went wrong.