In regards to using SOAP to connect to Sugar CRM, the documentation for Sugar 6.1 Community Edition states:
"See /examples/SugarFullTest_Version2.php for more examples on usage."
source:
http://developers.sugarcrm.com/docs/OS/6.1/-docs-Developer_Guides-Sugar_Developer_Guide_6.1.0-Chapter%202%20Application%20Framework.html#9000244
This file is not in the examples folder. Where is it?
If this file does not exist, where can I find a working example of connecting to Sugar CRM with SOAP? None of the test scripts in the /examples/ folder work.
Couldn't find the file either, so made an example (PHP script connecting to sugarCRM v6 SOAP) for you.
<?php
require_once('include/nusoap/lib/nusoap.php');
$myWsdl = 'http://mysite.com/soap.php?wsdl';
$myAuth = array(
'user_name' => 'xxxx',
'password' => MD5('xxxx'),
'version' => '0.1'
);
$soapClient = new nusoap_client($myWsdl,true);
// Create lead
// (Can be made without login, i.e. sessionid)
$leadParams = array('user_name' => 'xxxx',
'password' => MD5('xxxx'),
'first_name' => 'Test',
'last_name' => '2',
'email_address' => '2#'
);
$leadResult = $soapClient->call('create_lead', $leadParams);
$leadId = $leadResult;
print_r($leadResult);
// Login
$loginParams = array('user_auth' => $myAuth, 'application_name' => 'WebForm');
$loginResult = $soapClient->call('login', $loginParams);
$sessionId = $loginResult['id'];
// Modules
// (Need login, so sessionID is used)
$modulesResult = $soapClient->call('get_available_modules', array('session' => $sessionId));
print_r($modulesResult);
// Get account list
$accountParams = array('session' => $sessionId,
'module_name' => 'Accounts',
'query' => "accounts.name = 'Amarelo'",
'order_by' => '',
'deleted' => 0
);
$accountResult = $soapClient->call('get_entry_list', $accountParams);
print_r($accountResult);
// Get entry
$leadParams = array('session' => $sessionId,
'module_name' => 'Leads',
'id' => "$leadId"
);
$leadResult = $soapClient->call('get_entry', $leadParams);
print_r($leadResult);
// Logout
$logoutResult = $soapClient->call('logout', array('session' => $sessionId));
?>
For debugging and testing SoapUI is very helpful.
Related
i'm try to write dailymotion api upload php code
i'm use example code from https://developer.dailymotion.com/guides
it's work great
and i want add Geoblocking only allow Japan
this is my code
require_once 'Dailymotion.php';
// Account settings
$apiKey = 'xxxxxxxxxxxxxxxxxx';
$apiSecret = 'xxxxxxxxxxxxxxxxxx';
$testUser = 'xxxxxxxxxxxxxxxxxx#xxxx.com';
$testPassword = 'xxxxxxxxxxxxxxxxxx';
$videoTestFile = 'C:/output.mp4';
// Scopes you need to run your tests
$scopes = array(
'userinfo',
'feed',
'manage_videos',
);
// Dailymotion object instanciation
$api = new Dailymotion();
$api->setGrantType(
Dailymotion::GRANT_TYPE_PASSWORD,
$apiKey,
$apiSecret,
$scopes,
array(
'username' => $testUser,
'password' => $testPassword,
)
);
$url = $api->uploadFile($videoTestFile);
$result = $api->post(
'/videos',
array(
'url' => $url,
'title' => 'Dailymotion PHP SDK upload test 2',
'tags' => 'dailymotion,api,sdk,test',
'channel' => 'videogames',
'published' => true,
'geoblocking' => 'JP', // i'm add this line
)
);
var_dump($result);
but i got this error
Fatal error: Uncaught exception 'DailymotionAuthRequiredException' with message 'Insufficient rights for the `geoblocking' parameter of route `POST /videos'. Required scopes: manage_videos'
anyone can tell me
what i'm doing wrong and help me fix this problem
thank you
'geoblocking' => 'JP'
change to 'geoblocking' => 'jp'
your code will be
require_once 'Dailymotion.php';
// Account settings
$apiKey = 'xxxxxxxxxxxxxxxxxx';
$apiSecret = 'xxxxxxxxxxxxxxxxxx';
$testUser = 'xxxxxxxxxxxxxxxxxx#xxxx.com';
$testPassword = 'xxxxxxxxxxxxxxxxxx';
$videoTestFile = 'C:/output.mp4';
// Scopes you need to run your tests
$scopes = array(
'userinfo',
'feed',
'manage_videos',
);
// Dailymotion object instanciation
$api = new Dailymotion();
$api->setGrantType(
Dailymotion::GRANT_TYPE_PASSWORD,
$apiKey,
$apiSecret,
$scopes,
array(
'username' => $testUser,
'password' => $testPassword,
)
);
$url = $api->uploadFile($videoTestFile);
$result = $api->post(
'/videos',
array(
'url' => $url,
'title' => 'Dailymotion PHP SDK upload test 2',
'tags' => 'dailymotion,api,sdk,test',
'channel' => 'videogames',
'published' => true,
'geoblocking' => 'jp' // NO , in last line
)
);
var_dump($result);
I want to use AWSAccountUtils in my project to create AWS account. I have installed gem aws_account_utils too. What more do I need to do or what is that I am missing ? In my controller I have defined following function and code is :
def create_aws_account
require 'aws_account_utils'
#account_details = []
#account_values = {}
aws_utils = AwsAccountUtils::AwsAccountUtils.new()
details = { 'fullName' => 'Devanshu Kumar',
'company' => 'ABC',
'addressLine1' => 'CP, Bund Garden Road',
'city' => 'Pune',
'state' => 'Maharastra',
'postalCode' => '411007',
'phoneNumber' => '1234567890',
'guess' => 'Test Account Dev' }
resp = aws_utils.create_account(account_name: 'My Test Account Devanshu Kumar',
account_email: 'devanshu.kumar#abc.com',
account_password: 'password',
account_details: details)
#account_values = {:account_number => data_disk.resp}
#account_details.push #account_values
render :json => { created_aws_account: account_details }
end
AWS Account Details Error Image
i want to provide the possibility to login on my website by passing the username and password in the url. Something like this:
http://vabdat.local/rest/bpid/34.xml?User=Mustermann&password=abcdef123
But i have no idea how to solve that problem. I `m actually using CakePHP 2.x
public function beforeFilter() {
if(in_array(strtolower($this->params['controller']),array('rest'))){
$user = $this->Auth->identify($this->request, $this->response);
$this->Auth->login($user);
$this->Auth->authenticate = array('Basic' => array (
'fields' => array('User.username' => 'Username', 'User.password' => 'Password'),
'userModel' => 'User',
'passwordHasher' => 'Blowfish',
'scope' => array (
'User.active' => 1,
)
) );
$this->Security->unlockedActions = array();
}
else{
}
}
Can someone tell me how to find a solution to this?
Thanks a lot.
I have configured Zend Framework2 in my local machine (ubuntu 14.04 LTS) with IMB_db2 driver as below.
global.php
$conn_string = "DATABASE='';HOSTNAME='xxx';PORT='xxx';PROTOCOL=TCPIP;UID='xxx';PWD='xxx'";
return array(
'db' => array(
'driver' => 'ibmdb2',
'database' => $conn_string,
'username' => '',
'password' => '',
'hostname' => '',
'port' => '',
'driver_options' => array(
'DB2_ATTR_CASE' => DB2_CASE_LOWER
),
'platform_options' => array(
'quote_identifiers' => false
)
),
'service_manager' => array(
'factories' => array('Zend\Db\Adapter\Adapter' => 'Zend\Db\Adapter\AdapterServiceFactory'),
),
);
local.php
return array('db' => array('username' => 'xxx','password' => 'xxx',));
Using zend adapter I have called the stored procedure placed in a iseries box as below.
$sm = $this->getServiceLocator();
$this->adapter = $sm->get('Zend\Db\Adapter\Adapter');
$stmt = db2_prepare($this->adapter, 'Call <Procedure name>("xxx","xxx","?","?")');
if (!$stmt) {
die('Preparing Statement failed.' . db2_stmt_error());
}
From the above snippet I am getting 'Preparing Statement failed.' with out any error message.
When I print $this->adapter, it is giving connection object.
Can any one help me on this, please?
My models association chain:
ArchitectPurchase belongsTo ArchitectProfile belongsTo User
My action:
$this->ArchitectPurchase->recursive = -1;
$this->ArchitectPurchase->Behaviors->attach('Containable');
$this->paginate['joins'] = array(
array(
'table' => 'architect_profiles',
'alias' => 'ArchitectProfileJoin',
'type' => 'inner',
'conditions' => array(
'ArchitectProfileJoin.id = ArchitectPurchase.architect_profile_id'
)
),
array(
'table' => 'users',
'alias' => 'User',
'type' => 'inner',
'conditions' => array(
'User.id = ArchitectProfileJoin.user_id'
)
)
);
$this->paginate['order'] = 'User.name DESC';
$this->paginate['contain'] = array(
'ArchitectProfile' => array(
'fields' => array('ArchitectProfile.id'),
'User' => array(
'fields' => array('User.name')
)
)
);
$this->set('architectPurchases', $this->paginate());
This action works fine, ordering the results by User.name DESC. But when I use the link created with
echo $this->Paginator->sort('User.name')
in my view, it does not work!
Looking at the core files, I found that the validateSort method of the PaginatorComponent was the problem:
if ($object->hasField($field)) {
$order[$alias . '.' . $field] = $value;
} elseif ($object->hasField($key, true)) {
$order[$field] = $value;
} elseif (isset($object->{$alias}) && $object->{$alias}->hasField($field, true)) {
$order[$alias . '.' . $field] = $value;
}
As the User model is not directly associated with the ArchitectPurchase model, I get
$order = array()
instead of
$order = array('User.name' => 'asc')
I tried to use the $whitelist parameter, but still not working...
So I had to hack the core (noooo!!!), commenting from line 345 to 363 to make it work.
Am I doing something wrong or is this a 2.2.1 issue?
Thanks for posting this, I was actually having the same issue and with your insight of the problem I was able to solve it.
I posted a ticket on the issue tracker of CakePHP if anyone is interested, but basically they said it won't be fixed and offered two recommendations to bypass the problem.
The way I fixed it is I forced the model to be related with the one that has the field I'm interested in order by.