SugarCRM - Rest API - order_by和limit

时间:2014-01-12 17:28:38

标签: api rest sugarcrm

我正在尝试使用REST API使用'get_relationship'方法检索最近10条修改过的记录。

我的努力有多难,我无法通过/限制或两者同时申请。

我的代码如下

$get_relationships_parameters = array(
     'session'=>Yii::app()->user->sid,
     'module_name' => 'Contacts',
     'module_id' => Yii::app()->user->id->value,
     'link_field_name' => 'project',
     'related_module_query' => ' name  like "'.$searchkey.'%"',
     'related_fields' => array(
        'id',
        'name',
        'date_modified',
     ),
     'related_module_link_name_to_fields_array' => array(
     ),
     'deleted'=> '0',
     'order_by' => 'date_modified desc',
     'offset' => 0,
     'limit' => 4,
);

2 个答案:

答案 0 :(得分:1)

是。将休息呼叫网址更改为v4_1后,它开始工作。

我在order_by中也缺少一些东西吗?我无法按date_modified排序。任何线索?

此致 Marthala

答案 1 :(得分:0)

您可能会在我的博客SugarCRM: How to get list of all documents related to an account

上看到类似的示例

这看起来确实很奇怪。我运行了一个测试,其记录限制等于5,一切正常。我作为一个例子的帐户关联六个文件。我在我的存储库中使用的示例代码位于此地址getRelateDocument.php,并跟随请求的输出。该测试在Community Edition 6.5.8版上进行。 enter image description here

(
[entry_list] => Array
    (
        [0] => stdClass Object
            (
                [id] => 1c7d4b6b-ca64-485f-7aed-52d8625001f0
                [module_name] => Documents
                [name_value_list] => stdClass Object
                    (
                        [id] => stdClass Object
                            (
                                [name] => id
                                [value] => 1c7d4b6b-ca64-485f-7aed-52d8625001f0
                            )

                        [name] => stdClass Object
                            (
                                [name] => name
                                [value] => TrackerReport.zip
                            )

                    )

            )

        [1] => stdClass Object
            (
                [id] => 5037454c-5ca9-2f2f-6843-52d862448506
                [module_name] => Documents
                [name_value_list] => stdClass Object
                    (
                        [id] => stdClass Object
                            (
                                [name] => id
                                [value] => 5037454c-5ca9-2f2f-6843-52d862448506
                            )

                        [name] => stdClass Object
                            (
                                [name] => name
                                [value] => wpi_hook_v4.zip
                            )

                    )

            )

        [2] => stdClass Object
            (
                [id] => 50790693-a318-cc8a-592f-52d863da7ebc
                [module_name] => Documents
                [name_value_list] => stdClass Object
                    (
                        [id] => stdClass Object
                            (
                                [name] => id
                                [value] => 50790693-a318-cc8a-592f-52d863da7ebc
                            )

                        [name] => stdClass Object
                            (
                                [name] => name
                                [value] => Schedulers.zip
                            )

                    )

            )

        [3] => stdClass Object
            (
                [id] => 8b4c0450-1922-498f-4601-52272fa6e494
                [module_name] => Documents
                [name_value_list] => stdClass Object
                    (
                        [id] => stdClass Object
                            (
                                [name] => id
                                [value] => 8b4c0450-1922-498f-4601-52272fa6e494
                            )

                        [name] => stdClass Object
                            (
                                [name] => name
                                [value] => WebProxyService_A.png
                            )

                    )

            )

        [4] => stdClass Object
            (
                [id] => 930e4fed-61f6-c24e-b8fc-52d863def56b
                [module_name] => Documents
                [name_value_list] => stdClass Object
                    (
                        [id] => stdClass Object
                            (
                                [name] => id
                                [value] => 930e4fed-61f6-c24e-b8fc-52d863def56b
                            )

                        [name] => stdClass Object
                            (
                                [name] => name
                                [value] => Sugar_Developer_Guide_6.3.0.pdf
                            )

                    )

            )

    )

[relationship_list] => Array
    (
    )