@@ -1,22 +1,22 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
4 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
5 | 5 | |
6 | 6 | try{ |
7 | - $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Pro/7700/',array('username' => 'admin','password'=>'asdf')); |
|
7 | + $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Pro/7700/', array('username' => 'admin', 'password'=>'asdf')); |
|
8 | 8 | $SugarAPI->login(); |
9 | 9 | $EP = $SugarAPI->filterRecords('Accounts'); |
10 | 10 | $response = $EP->execute()->getResponse(); |
11 | 11 | if ($response->getStatus()=='200'){ |
12 | 12 | $recordList = $response->getBody(false); |
13 | - $max=count($recordList->records); |
|
13 | + $max = count($recordList->records); |
|
14 | 14 | echo "found $max records from Filter Records request. <br>"; |
15 | - $number = rand(0,$max); |
|
15 | + $number = rand(0, $max); |
|
16 | 16 | $randomRecord = $recordList->records[$number]; |
17 | 17 | echo "Choose random record #$number, with ID: ".$randomRecord->id." <br>"; |
18 | 18 | |
19 | - $getRecord = $SugarAPI->getRecord('Accounts',$randomRecord->id)->execute(array( |
|
19 | + $getRecord = $SugarAPI->getRecord('Accounts', $randomRecord->id)->execute(array( |
|
20 | 20 | 'fields' => 'name' |
21 | 21 | )); |
22 | 22 | $response = $getRecord->getResponse(); |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
3 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
4 | 4 | |
5 | 5 | try{ |
6 | - $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Pro/7621/',array('username' => 'admin','password'=>'asdf')); |
|
6 | + $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Pro/7621/', array('username' => 'admin', 'password'=>'asdf')); |
|
7 | 7 | $SugarAPI->login(); |
8 | 8 | $EP = $SugarAPI->createRecord('Accounts'); |
9 | 9 | $data = array( |
@@ -13,12 +13,12 @@ discard block |
||
13 | 13 | $response = $EP->execute($data)->getResponse(); |
14 | 14 | if ($response->getStatus()=='200'){ |
15 | 15 | $record = $response->getBody(false); |
16 | - $EP2 = $SugarAPI->getRecord('Accounts',$record->id)->execute(array('fields' => 'name,email1')); |
|
16 | + $EP2 = $SugarAPI->getRecord('Accounts', $record->id)->execute(array('fields' => 'name,email1')); |
|
17 | 17 | $getResponse = $EP2->getResponse(); |
18 | 18 | print $EP2->getUrl(); |
19 | 19 | print_r($getResponse->getBody()); |
20 | 20 | } |
21 | 21 | |
22 | -}catch(\SugarAPI\SDK\Exception\AuthenticationException $ex){ |
|
22 | +}catch (\SugarAPI\SDK\Exception\AuthenticationException $ex){ |
|
23 | 23 | print $ex->getMessage(); |
24 | 24 | } |
25 | 25 | \ No newline at end of file |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
4 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
5 | 5 | |
6 | 6 | try{ |
7 | - $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Pro/7700/',array('username' => 'admin','password'=>'asdf')); |
|
7 | + $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Pro/7700/', array('username' => 'admin', 'password'=>'asdf')); |
|
8 | 8 | $SugarAPI->login(); |
9 | 9 | |
10 | 10 | $Accounts = $SugarAPI->filterRecords('Accounts')->setData(array('max_num'=> 5)); |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | require_once __DIR__.'/../vendor/autoload.php'; |
4 | 4 | |
5 | -try { |
|
5 | +try{ |
|
6 | 6 | $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Ent/7621/', array( |
7 | 7 | 'username' => 'admin', |
8 | 8 | 'password' => 'asdf' |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | 'username' => 'admin', |
19 | 19 | 'password' => 'asdf' |
20 | 20 | )); |
21 | - if ($SugarAPI2->authenticated()) { |
|
21 | + if ($SugarAPI2->authenticated()){ |
|
22 | 22 | echo "Authenticated!"; |
23 | 23 | print_r($SugarAPI2->getToken()); |
24 | 24 | } |
25 | -} catch(\SugarAPI\SDK\Exception\SDKException $ex){ |
|
25 | +}catch (\SugarAPI\SDK\Exception\SDKException $ex){ |
|
26 | 26 | print_r($ex->getMessage()); |
27 | 27 | } |
28 | 28 | \ No newline at end of file |