#1  
Old 2009-06-29, 08:32 PM
jcorry jcorry is offline
Senior Member
 
Join Date: Jun 2009
Posts: 26
Default REST documentation a little light

I have been using the SOAP interface to get/put records from Sugar and find it's performance a little slow for current project.

We had high hopes for the REST interface in Sugar 5.5.

The webservices API guide is a little light on documentation for using the REST interface.

Are there any PHP examples online that your team knows about?
  #2  
Old 2009-06-29, 09:23 PM
sgandhi sgandhi is offline
Sugar Team Member
 
Join Date: Aug 2007
Posts: 217
Default Re: REST documentation a little light

Look at service/test.html which is a javascript examples file for just to start with. I will post PHP examples in a while.

-Samir
  #3  
Old 2009-06-30, 02:24 AM
jcorry jcorry is offline
Senior Member
 
Join Date: Jun 2009
Posts: 26
Default Re: REST documentation a little light

I'm eager to see PHP examples...right now I'm trying variations of this:
Code:
$userAuth = array('user_name' => $user, 'password' => md5($pass));

$req =& new HTTP_Request($rootURL);
$req->setMethod(HTTP_REQUEST_METHOD_POST);
$req->addPostData('method', 'login');
$req->addPostData('user_auth', $userAuth);
$req->addPostData('application', 'TRIPInfo');
$req->sendRequest();
$list = $req->getResponseBody();
And it generates a 500 response from the server with the message:

Quote:
<b>Warning</b>: Missing argument 1 for SugarWebServiceImpl::login(), called in /var/www/vhosts/tripinfo/htdocs/sugar55beta/service/core/REST/SugarRest.php on line 79 and defined in <b>/var/www/vhosts/tripinfo/htdocs/sugar55beta/service/core/SugarWebServiceImpl.php</b> on line <b>500</b><br />
<br />
<b>Warning</b>: Missing argument 2 for SugarWebServiceImpl::login(), called in /var/www/vhosts/tripinfo/htdocs/sugar55beta/service/core/REST/SugarRest.php on line 79 and defined in <b>/var/www/vhosts/tripinfo/htdocs/sugar55beta/service/core/SugarWebServiceImpl.php</b> on line <b>500</b><br />
<br />
<b>Warning</b>: Missing argument 3 for SugarWebServiceImpl::login(), called in /var/www/vhosts/tripinfo/htdocs/sugar55beta/service/core/REST/SugarRest.php on line 79 and defined in <b>/var/www/vhosts/tripinfo/htdocs/sugar55beta/service/core/SugarWebServiceImpl.php</b> on line <b>500</b><br />
<br>500 Internal Server Error <br>10: Invalid Login<br>Login attempt failed please check the username and password'
  #4  
Old 2009-06-30, 11:49 PM
sgandhi sgandhi is offline
Sugar Team Member
 
Join Date: Aug 2007
Posts: 217
Default Re: REST documentation a little light

Here is the correct code.

$req =& new HTTP_Request($url);
$req->setMethod(HTTP_REQUEST_METHOD_POST);
$req->addPostData('method', 'login');
$req->addPostData('input_type', 'json');
$req->addPostData('response_type', 'json');
$json = getJSONobj();
$jsonEncodedData = $json->encode(array('user_auth'=>array('user_name'=>$use r_name,'password'=>md5($user_password), 'version'=>'.01'), 'application_name'=>'TRIPInfo', 'name_value_list' => array()), false);
$req->addPostData('rest_data', $jsonEncodedData);
$req->sendRequest();
$list = $req->getResponseBody();

Try out this one and let me know what u get.

-Samir
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Light Box Implementation gopalkrishnab Developer Help 2 2009-02-09 10:49 PM
light box functionality on a custom button danrweki Developer Help 2 2009-01-19 11:07 AM
light box functionality on a custom button danrweki Developer Tutorials 0 2009-01-17 01:39 PM
SugarCRM Light dkonig Polish 0 2007-06-26 03:22 PM
How can I see the tasks of the rest of my team? ziv Help 1 2006-02-11 04:21 AM


All times are GMT. The time now is 07:54 AM.


Powered by: vBulletin
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SourceForge.net Logo