@@ -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(); |
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)->data(array( |
|
19 | + $getRecord = $SugarAPI->getRecord('Accounts', $randomRecord->id)->data(array( |
|
20 | 20 | 'fields' => 'name' |
21 | 21 | ))->execute(); |
22 | 22 | $response = $getRecord->getResponse(); |
@@ -98,7 +98,7 @@ |
||
98 | 98 | $response = $EP->data($this->authOptions)->execute()->getResponse(); |
99 | 99 | if ($response->getStatus()=='200'){ |
100 | 100 | $this->authToken = $response->getBody(); |
101 | - } else{ |
|
101 | + }else{ |
|
102 | 102 | throw new AuthenticationException($response->getBody()); |
103 | 103 | } |
104 | 104 | } |