This repository has been archived by the owner on Jun 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
63 lines (44 loc) · 2.12 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
PHP API for the SugarCRM Web Services API
Introduction:
We are working in a group of 5 members in order to design, implement, and demonstrate a user friendly API for an open source web services API. The API that we will be working with is SugarCRM API. As part of the development of this project we will work under the guidance of a representative, John Mertic, of the SugarCRM company. The project development procedures will be similar to those used by that company.
- Download the files from:
https://github.com/jmertic/KSU_Capstone_Spring_2011_PHP/zipball/master
- Extract to folder in your root directory
- To change the default configuration, edit the Config.class.php file in the root of this project.
- Follow code examples below
<?php
// Include the wrapper class
require_once 'SugarApi.class.php';
// Instantiate the wrapper class
$sugar = new SugarApi();
// Log in using the default configuration data
$session_id = $sugar->login();
// Get the user object of the user with the specified username
$result = $sugar->findUserByUserName('');
print_r($result);
// Get the contact object with the given last name
$result = $sugar->findContactByLastName('');
print_r($result);
// Get the account object with the given last name
$result = $sugar->findAccountByName('');
print_r($result);
// Logout after you're done
$sugar->logout();
?>
For more examples, go to this link: https://github.com/jmertic/KSU_Capstone_Spring_2011_PHP/tree/master/examples
To change the connection info at run-time, see below:
<?php
// Include the wrapper class and SugarCurlRequest class
require_once 'SugarApi.class.php';
require_once 'curl/SugarCurlRequest.class.php';
// Instantiate the wrapper class and curl object
$sugar = new SugarApi();
$curlR = new Curl_SugarCurlRequest();
// Set the host and Api version
$curlR->setHost('');
$curlR->setApiVersion(2);
// Set the curl object in the wrapper class
$sugar->_curl = $curlR;
// Log in with username and password
$user_id = $sugar->login('<user_name>', '<password>');
?>