Java SugarCRM访问被拒绝号码40
我正在尝试从以下活动机会中获取所有联系人,这是我对SugarCRM API v4的请求Java SugarCRM访问被拒绝号码40,java,sugarcrm,Java,Sugarcrm,我正在尝试从以下活动机会中获取所有联系人,这是我对SugarCRM API v4的请求 { "session":"btcskfetq7sqshio3uv568d8c1", "module_name":"Contacts", "query":"contacts.id IN ( SELECT opportunities_contacts.contact_id FROM opportunities_contacts JOIN opport
{
"session":"btcskfetq7sqshio3uv568d8c1",
"module_name":"Contacts",
"query":"contacts.id IN (
SELECT opportunities_contacts.contact_id
FROM opportunities_contacts
JOIN opportunities
ON opportunities_contacts.opportunity_id = opportunities.id
WHERE opportunities.sales_stage
NOT IN ('Closed Won','Closed Lost'))",
"order_by":"",
"offset":0,
"select_fields":[
"first_name",
"last_name",
"title",
"phone_home",
"phone_work",
"status",
"email"
],
"link_name_to_fields_array":null,
"max_results":0,
"deleted":0,
"favorites":false
}
我的查询在sugarCRM数据库的mysql workbench中运行良好,但API响应为:
{“名称”:“访问被拒绝”,“编号”:40,“说明”:“您没有访问权”}
您能帮忙吗?要实现这一点,您需要在suagrcrm中编写自己的结束点
<?php
class AtRiskApi extends SugarApi
{
// This function is only called whenever the rest service cache file is deleted.
// This shoud return an array of arrays that define how different paths map to different functions
public function registerApiRest() {
return array(
'getAtRisk' => array(
// What type of HTTP request to match against, we support GET/PUT/POST/DELETE
'reqType' => 'GET',
// This is the path you are hoping to match, it also accepts wildcards of ? and <module>
'path' => array('Accounts', 'at_risk'),
// These take elements from the path and use them to populate $args
'pathVars' => array('', ''),
// This is the method name in this class that the url maps to
'method' => 'getAtRisk',
// The shortHelp is vital, without it you will not see your endpoint in the /help
'shortHelp' => 'Lists at risk accounts in the system',
// The longHelp points to an HTML file and will be there on /help for people to expand and show
'longHelp' => '',
),
);
}
function getAtRisk($api, $args)
{
// Start off with something simple so we can verify the endpoint is registered.
return 'burgers';
}
}
谢谢Amitesh,我将对此进行研究。这是针对v10 API的,但问题是关于v4的。您必须使用最新版本的v10。我认为这对于v4也是一样的。我单独实现了API v4和v10,我可以在v10中实现这一点,但不能在v4中实现。如果您使用的是最新版本的sugarcrmLooks,比如身份验证问题。有没有更简单的请求?我想你需要用MD5散列你的密码,如果你还没有这样做的话