@@ -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)); |
@@ -22,17 +22,17 @@ |
||
| 22 | 22 | echo "<h3>Requests Completed</h3><pre>"; |
| 23 | 23 | print_r($response->getBody()); |
| 24 | 24 | echo "</pre>"; |
| 25 | - }else{ |
|
| 25 | + } else{ |
|
| 26 | 26 | echo "<h3>Request Failed</h3><pre>"; |
| 27 | 27 | print_r($response); |
| 28 | 28 | echo "</pre>"; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | -}catch (\SugarAPI\SDK\Exception\Authentication\AuthenticationException $ex){ |
|
| 31 | +} catch (\SugarAPI\SDK\Exception\Authentication\AuthenticationException $ex){ |
|
| 32 | 32 | echo "Credentials:<pre>"; |
| 33 | 33 | print_r($SugarAPI->getCredentials()); |
| 34 | 34 | echo "</pre> Error Message: "; |
| 35 | 35 | print $ex->getMessage(); |
| 36 | -}catch (\SugarAPI\SDK\Exception\SDKException $ex){ |
|
| 36 | +} catch (\SugarAPI\SDK\Exception\SDKException $ex){ |
|
| 37 | 37 | echo $ex->__toString(); |
| 38 | 38 | } |
| 39 | 39 | \ No newline at end of file |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | $EP = $SugarAPI->createRecord('Notes')->execute(array('name' => 'Test Note')); |
| 9 | 9 | $response = $EP->getResponse(); |
| 10 | 10 | if ($response->getStatus()=='200'){ |
| 11 | - $record = $response->getBody(false); |
|
| 11 | + $record = $response->getBody(FALSE); |
|
| 12 | 12 | |
| 13 | 13 | $upload = $SugarAPI->attachFile('Notes', $record->id, 'filename')->execute(__DIR__.'/testfile.txt'); |
| 14 | 14 | $response = $upload->getResponse(); |
@@ -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 |
@@ -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,7 +18,7 @@ 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 | } |