【问题标题】:Ez Publish Unable to get REST API workingEz Publish 无法使 REST API 正常工作
【发布时间】:2013-05-29 11:18:54
【问题描述】:

我是 Ez Publish 的新手,我想让默认的 Rest API 作为第一步工作,然后为移动通信目的开发我自己的 Rest API 扩展,但我一开始就被阻止了。

当我尝试从 "www.mydomain.com/api/ezp/content/node/2/list" 获取结果时,我得到 "{"error_message":"Not找到"}"

配置完成:

设置/覆盖/site.ini.append.php

[ExtensionSettings]
ActiveExtensions[]
ActiveExtensions[]=ezprestapiprovider
...

extension/ezprestapiprovider/settings/rest.ini.append.php

<?php /* #?ini charset="utf-8"?

[ApiProvider]
ProviderClass[ezp]=ezpRestApiProvider

[Authentication]
RequireAuthentication=disabled

*/ ?>

.htaccess

DirectoryIndex index.php

RewriteEngine On
RewriteRule api index_rest.php [L]
RewriteRule ^index_rest\.php - [L]
...

我为我的英语道歉。

Edit1:Ez Publish 4.5 版

Edit2:当我更改“www.mydomain.com/api/ezp/content/node/2/list”时,这似乎是RewirteRule的问题"www.mydomain.com/index_rest.php/api/ezp/content/node/2/list" 它可以工作,我该如何解决?

编辑3: 我尝试了下面的所有重写规则,除了最后一个之外仍然无法正常工作。

# RewriteRule ^/api/ /index_rest.php [L] 
# RewriteRule ^api/(.*) /index_rest.php/$1 [R=302,NC] 
# RewriteRule ^/api/(.*) /index_rest.php/api/$1 [NC,L] 
RewriteRule api index_rest.php [L] 

但是当我尝试添加新扩展时,它似乎会产生冲突...... 我添加了一个新扩展,当我尝试访问它时,日志文件出现错误:

意外错误,消息是:找不到 API 提供程序“移动”。在 mydomaine.com\kernel\private\rest\classes\rest_provider.php 第 37 行

【问题讨论】:

    标签: rest ezpublish


    【解决方案1】:

    尝试用 eZ 指定的重写规则替换那些重写规则

    RewriteRule ^/api/ /index_rest\.php [L]
    

    这里列出了 4.5 版:http://doc.ez.no/eZ-Publish/Technical-manual/4.5/Installation/Virtual-host-setup

    【讨论】:

    • 我尝试了下面所有的重写规则,除了最后一个之外仍然没有工作。 # RewriteRule ^/api/ /index_rest.php [L] # RewriteRule ^api/(.*) /index_rest.php/$1 [R=302,NC] # RewriteRule ^/api/(.*) /index_rest.php/ api/$1 [NC,L] RewriteRule api index_rest.php [L] 但是当我尝试添加新扩展时它似乎会创建冲突...
    【解决方案2】:

    我刚刚重新生成自动加载,它现在正在工作。我使用 cmd 行来执行此操作(使用管理模块重新生成自动加载对我不起作用)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-07-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-28
      • 1970-01-01
      相关资源
      最近更新 更多