Unable to get REST API working

Author Message

Felix Laate

Wednesday 06 July 2011 1:19:16 am

Hi all!

On a site running 2011.5, I try to utilize the new REST API. I tried the built-in extension (restapiprovider), but it only returns blank pages. The error-logs says nothing.

Then I tried to make an extension as documented in the docs, but that only gives an unexpected error. The error-log says "Unexpected error, the message was : The API provider 'ezx' could not be found. in /home/greaterstavanger/www/kernel/private/rest/classes/rest_provider.php on line 37".

Que pasa, anybody?

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Markus Birth

Wednesday 06 July 2011 2:10:07 am

Things to check:

  • are your RewriteRules correct (RewriteRule ^api/ index_rest.php [L])?
  • did you do correct OAuth 2.0 authentication (http://example.org/oauth/authorize)?
  • does the user have the correct rights/permissions to use the REST API?
  • do you send Authorization and Accept headers with your REST request?

You can try the communication using Jérôme's eZ REST Debugger.

Thiago Campos Viana

Wednesday 06 July 2011 4:46:27 am

I've got some poblems using 2011.5, so I suggest you upgrade to the latest build (2011.6), then you could check my Rest API "Hello world" topic and my blog post: REST API, Basic HTTP Auth, and PhoneGap using jQuery

Just don't forget to change your install settings to use virtual host and remove the index.php from your SiteURL settings and so on...

eZ Publish Certified Developer: http://auth.ez.no/certification/verify/376924

Twitter: http://twitter.com/tcv_br

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 17 2025 23:50:56
Script start
Timing: Jan 17 2025 23:50:56
Module start 'layout'
Timing: Jan 17 2025 23:50:56
Module start 'content'
Timing: Jan 17 2025 23:50:57
Module end 'content'
Timing: Jan 17 2025 23:50:57
Script end

Main resources:

Total runtime0.7048 sec
Peak memory usage4,096.0000 KB
Database Queries61

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0056 587.9141152.6250
Module start 'layout' 0.00560.0038 740.539139.4531
Module start 'content' 0.00940.6940 779.9922584.2734
Module end 'content' 0.70340.0014 1,364.265612.1641
Script end 0.7048  1,376.4297 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.4926160.0002
Check MTime0.00140.1935160.0001
Mysql Total
Database connection0.00080.107510.0008
Mysqli_queries0.654492.8562610.0107
Looping result0.00060.0821590.0000
Template Total0.674995.820.3374
Template load0.00200.290020.0010
Template processing0.672895.461620.3364
Template load and register function0.00010.012210.0001
states
state_id_array0.00100.141410.0010
state_identifier_array0.00070.094520.0003
Override
Cache load0.00170.2380280.0001
Sytem overhead
Fetch class attribute can translate value0.00100.136130.0003
Fetch class attribute name0.00090.134850.0002
XML
Image XML parsing0.00090.132730.0003
class_abstraction
Instantiating content class attribute0.00000.001050.0000
General
dbfile0.00090.1332220.0000
String conversion0.00000.001640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/emphasize.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/emphasize.tplEdit templateOverride template
3content/datatype/view/ezxmltags/li.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/li.tplEdit templateOverride template
1content/datatype/view/ezxmltags/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.tplEdit templateOverride template
1content/datatype/view/ezxmltags/ul.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/ul.tplEdit templateOverride template
2content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 20
 Number of unique templates used: 10

Time used to render debug report: 0.0002 secs