@@ -1,21 +1,21 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
3 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
4 | 4 | |
5 | 5 | $record_id = '436dcb0b-14a9-c0d4-3046-5706b186b9b8'; |
6 | 6 | |
7 | 7 | try{ |
8 | - $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Pro/7621/',array('username' => 'admin','password'=>'asdf')); |
|
8 | + $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Pro/7621/', array('username' => 'admin', 'password'=>'asdf')); |
|
9 | 9 | $SugarAPI->login(); |
10 | - $EP = $SugarAPI->updateRecord('Accounts',$record_id); |
|
10 | + $EP = $SugarAPI->updateRecord('Accounts', $record_id); |
|
11 | 11 | $EP->getRequest()->setOption(); |
12 | - $record = $SugarAPI->updateRecord('Accounts',$record_id)->data(array( |
|
12 | + $record = $SugarAPI->updateRecord('Accounts', $record_id)->data(array( |
|
13 | 13 | 'name' => 'Test Record 5', |
14 | 14 | 'email1' => '[email protected]' |
15 | 15 | ))->execute()->getResponse()->getBody(); |
16 | 16 | echo "Updated Record: ".$record->id; |
17 | 17 | |
18 | -}catch(\SugarAPI\SDK\Exception\AuthenticationException $ex){ |
|
18 | +}catch (\SugarAPI\SDK\Exception\AuthenticationException $ex){ |
|
19 | 19 | print $ex->getMessage(); |
20 | 20 | } |
21 | 21 |
@@ -1,13 +1,13 @@ 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 | $recordID = 'ac096703-67fd-8dd2-980a-57097932f07a'; |
6 | 6 | |
7 | 7 | try{ |
8 | - $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Ent/7700/',array('username' => 'admin','password'=>'asdf')); |
|
8 | + $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Ent/7700/', array('username' => 'admin', 'password'=>'asdf')); |
|
9 | 9 | $SugarAPI->login(); |
10 | - $EP = $SugarAPI->getAttachment('Notes',$recordID,'filename')->downloadTo(__DIR__)->execute(); |
|
10 | + $EP = $SugarAPI->getAttachment('Notes', $recordID, 'filename')->downloadTo(__DIR__)->execute(); |
|
11 | 11 | $response = $EP->getResponse(); |
12 | 12 | if ($response->getStatus()=='200'){ |
13 | 13 | if (file_exists($response->file())){ |
@@ -20,6 +20,6 @@ discard block |
||
20 | 20 | print_r($response->getBody()); |
21 | 21 | } |
22 | 22 | |
23 | -}catch(\SugarAPI\SDK\Exception\SDKException $ex){ |
|
23 | +}catch (\SugarAPI\SDK\Exception\SDKException $ex){ |
|
24 | 24 | print $ex->getMessage(); |
25 | 25 | } |
26 | 26 | \ No newline at end of file |
@@ -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 | $EP->data(array( |
@@ -13,12 +13,12 @@ discard block |
||
13 | 13 | $response = $EP->execute()->getResponse(); |
14 | 14 | if ($response->getStatus()=='200'){ |
15 | 15 | $record = $response->getBody(); |
16 | - $EP2 = $SugarAPI->getRecord('Accounts',$record->id)->data(array('fields' => 'name,email1')); |
|
16 | + $EP2 = $SugarAPI->getRecord('Accounts', $record->id)->data(array('fields' => 'name,email1')); |
|
17 | 17 | $getResponse = $EP2->execute()->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,22 +1,22 @@ discard block |
||
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(); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | echo "Retrieved Record <br>"; |
25 | 25 | $randomRecord = $getRecord->getResponse()->getBody(); |
26 | 26 | |
27 | - $updateRecord = $SugarAPI->updateRecord('Accounts',$randomRecord->id)->data(array( |
|
27 | + $updateRecord = $SugarAPI->updateRecord('Accounts', $randomRecord->id)->data(array( |
|
28 | 28 | 'name' => 'Updated Record Name' |
29 | 29 | ))->execute(); |
30 | 30 | $response = $updateRecord->getResponse(); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | echo "Updated Record <br>"; |
34 | 34 | print_r($randomRecord); |
35 | 35 | |
36 | - $deleteRecord = $SugarAPI->deleteRecord('Accounts',$randomRecord->id)->execute(); |
|
36 | + $deleteRecord = $SugarAPI->deleteRecord('Accounts', $randomRecord->id)->execute(); |
|
37 | 37 | $response = $deleteRecord->getResponse(); |
38 | 38 | if ($response->getStatus()=='200'){ |
39 | 39 | $response = $deleteRecord->getResponse()->getBody(); |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | echo "Response: ".$response->getStatus(); |
60 | 60 | print_r($response->getBody()); |
61 | 61 | } |
62 | -}catch(\SugarAPI\SDK\Exception\AuthenticationException $ex){ |
|
62 | +}catch (\SugarAPI\SDK\Exception\AuthenticationException $ex){ |
|
63 | 63 | echo "Auth Options:<pre>"; |
64 | 64 | print_r($SugarAPI->getAuthOptions()); |
65 | 65 | echo "</pre> Error Message: "; |
66 | 66 | print $ex->getMessage(); |
67 | -}catch(\SugarAPI\SDK\Exception\SDKException $ex){ |
|
67 | +}catch (\SugarAPI\SDK\Exception\SDKException $ex){ |
|
68 | 68 | echo $ex->__toString(); |
69 | 69 | } |
@@ -1,16 +1,16 @@ 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/Ent/7700/',array('username' => 'admin','password'=>'asdf')); |
|
6 | + $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Ent/7700/', array('username' => 'admin', 'password'=>'asdf')); |
|
7 | 7 | $SugarAPI->login(); |
8 | 8 | $EP = $SugarAPI->createRecord('Notes')->data(array('name' => 'Test Note'))->execute(); |
9 | 9 | $response = $EP->getResponse(); |
10 | 10 | if ($response->getStatus()=='200'){ |
11 | 11 | $record = $response->getBody(); |
12 | 12 | |
13 | - $upload = $SugarAPI->attachFile('Notes',$record->id,'filename')->data(array( |
|
13 | + $upload = $SugarAPI->attachFile('Notes', $record->id, 'filename')->data(array( |
|
14 | 14 | 'filename' => __DIR__.'/testfile.txt;filename=testfile.txt' |
15 | 15 | ))->execute(); |
16 | 16 | $response = $upload->getResponse(); |
@@ -29,6 +29,6 @@ discard block |
||
29 | 29 | print_r($response->getBody()); |
30 | 30 | } |
31 | 31 | |
32 | -}catch(\SugarAPI\SDK\Exception\SDKException $ex){ |
|
32 | +}catch (\SugarAPI\SDK\Exception\SDKException $ex){ |
|
33 | 33 | print $ex->getMessage(); |
34 | 34 | } |
35 | 35 | \ No newline at end of file |
@@ -1,18 +1,18 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
3 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
4 | 4 | |
5 | 5 | $record_id = 'a887c75b-b89a-852e-8e67-56f1ccdee355'; |
6 | 6 | |
7 | 7 | try{ |
8 | - $SugarAPI = new \SugarAPI\SDK\SugarAPI('localhost/ent77',array('username' => 'admin','password'=>'admin123')); |
|
8 | + $SugarAPI = new \SugarAPI\SDK\SugarAPI('localhost/ent77', array('username' => 'admin', 'password'=>'admin123')); |
|
9 | 9 | $SugarAPI->login(); |
10 | - $EP = $SugarAPI->favorite('Accounts',$record_id); |
|
10 | + $EP = $SugarAPI->favorite('Accounts', $record_id); |
|
11 | 11 | $response = $EP->execute()->getResponse()->getBody(); |
12 | 12 | |
13 | 13 | print_r($response); |
14 | 14 | |
15 | -}catch(\SugarAPI\SDK\Exception\AuthenticationException $ex){ |
|
15 | +}catch (\SugarAPI\SDK\Exception\AuthenticationException $ex){ |
|
16 | 16 | print $ex->getMessage(); |
17 | 17 | } |
18 | 18 |