gpt4 book ai didi

java - SugarCRM 访问被拒绝编号 40

转载 作者:行者123 更新时间:2023-11-30 06:47:59 26 4
gpt4 key购买 nike

我正在尝试从下面的 Activity 机会中获取所有联系人,这是我对 SugarCRM API v4 的请求

{
"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工作台中工作正常,但API响应是:

{"name":"访问被拒绝","number":40,"description":"您没有访问权限"}

你能帮忙吗?

最佳答案

要实现此目标,您需要在 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';
}
}

欲了解更多详情,请阅读:

Read me ...

关于java - SugarCRM 访问被拒绝编号 40,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43342365/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com