2017-04-11 6 views
1

私は下の活性機会からすべての連絡先を取得しようとしていますが、SugarCRM社のAPI V4の私の要求である40番を否定した私のクエリは、SugarCRMのデータベースが、APIでのMySQLのワークベンチでは正常に動作しているSugarCRMのアクセスが

{ 
    "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 
} 

応答は次のとおりです。

{"name":"Access Denied","number":40,"description":"You do not have access"}

あなたは助けることはできますか?

+0

認証の問題のように見えます。より簡単なリクエストは機能しますか?私はあなたがそれをしていない場合はMD5でパスワードをハッシュする必要があると思う。 – MartinTawse

+0

MD5を使用してパスワードのハッシュを行った – Jagan

答えて

1

sugrcrmに独自のエンドポイントを書き込むことができます。詳細については

<?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 ...

+0

ありがとうAmitesh私はこれを調べます。 – Jagan

+0

あなたがアップフォートして答えを受け入れるのに役立つならば。 –

+0

これはv10 API用ですが、問題はv4に関するものでした。 – MartinTawse

関連する問題