eZ Community » Forums » Extensions » Unable to get REST API working
expandshrink

Unable to get REST API working

Unable to get REST API working

Wednesday 29 May 2013 1:37:56 pm - 2 replies

Hi.

I am new to Ez Publish, I would like to make the default Rest API working as a first step and next developing my own Rest API extension for mobile communication purpose but I am blocked at the first one.

when I try to get the result from "www.mydomain.com/api/ezp/content/node/2/list" I get "{"error_message":"Not Found"}"

configurations are done:

setting/override/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]...

I apologize for my English.

Ez Publish version 4.5

Edit3: I tried all rewriterules below, still not working except the last one.

# 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] 

But it seems to create conflit when I try to add new extension... I added a new extension and when I try to access to it I got an error on the log file:

Unexpected error, the message was : The API provider 'mobile' could not be found. in mydomaine.com\kernel\private\rest\classes\rest_provider.php on line 37

Modified on Thursday 30 May 2013 10:35:45 am by AbdelAli Eramli

Friday 31 May 2013 2:12:40 pm

I think the most simple rewrite rule for your case is:

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

it should work, as long as you do not have content names starting with "api..."

As for your own extension adding rest functionality, it should also be registered in rest.ini.append.php

See http://projects.ez.no/ezcontentstaging/ for an example of an extensions doing that

Friday 31 May 2013 5:44:37 pm

Thank you for your reply, but the RewriteRule did not work for me.I regenerate autoload, It's working know. ( cmd command !! )

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from