I want just send this email to all people that are trying to use REST API,
this chat could help someone install and use this new extension.

[15:00] *** now talking in #ezpublish
[15:00] *** topic is Welcome | eZ Publish | http://share.ez.no |
http://ez.no/doc | http://ezpedia.org | Keep clearing your caches! :)
[15:00] *** set by kracker on Sun Jan 24 01:20:23 2010
[15:00] *** channel #ezpublish mode is +nt
[15:00] *** channel created at Tue Jan 27 03:29:47 2009
[15:00] <tcv_br> Katana
[15:00] <Katana`> evening Thiago :)
[15:00] <Katana`> so
[15:00] <tcv_br> hi
[15:00] <Katana`> the endpoint URI is the URI the oauth process will
redirect to at the end
[15:00] <Katana`> so it basically is your REST client (the PHP script) URL
[15:00] <tcv_br> mmmm
[15:01] <tcv_br> wait
[15:01] <Katana`> it doesn't support wildcards yet, I know that sucks :(
[15:01] *** i-robin ([email protected]) joined
[15:01] <Katana`> don't worry I'm waiting :)
[15:01] <Katana`> evening Robin !
[15:01] <tcv_br> it could be:
extension/rest/examples/api-content-node-2.php   ???
[15:01] <Katana`> hmmm
[15:01] *** i-robin quit (Client Quit)
[15:01] <Katana`> well, yes, it could (with http://)
[15:02] <Katana`> but it wouldn't make much sense. The script in examples
can be a bit misleading... they 'cheat' a bit as they use the internals of
the REST client
[15:02] <Katana`> have you checked the script on gist.github.com ?
[15:02] <tcv_br> a locahost example should be
http://localhost/extension/rest/examples/api-content-node-2.php ??
[15:02] <Katana`> yes, but with my comment above :)
[15:03] *** i-robin ([email protected]) joined
[15:03] <Katana`> hi again robin... ?
[15:03] <i-robin> hi
[15:04] <i-robin> something didn't quite work :)
[15:04] <Katana`> seems so :)
[15:05] <tcv_br> mm.... don't know what to do... this extension is too
advanced
[15:05] <Katana`> you don't have to dig into the extension itself
[15:05] <Katana`> let's go step by step
[15:05] <Katana`> have you seen the script on http://gist.github.com/602862?
[15:05] <tcv_br> I registered my oauth client /oauthadmin/list
[15:06] <Katana`> wait, answer my question please ;)
[15:06] <tcv_br> Name: REST application
[15:06] <tcv_br> no
[15:06] <Katana`> you should ;)
[15:07] <tcv_br> I'm reading
[15:07] <Katana`> but I need to be sure you've understood the principle: the
REST interface is meant to be used from another app (web, mobile, etc etc)
[15:07] <Katana`> so to test, you need 1) an eZ Publish instance with the
REST extension 2) a script, on the same server or another, completely
independant of eZ Publish
[15:08] <Katana`> #2 is exactly what the script on
http://gist.github.com/602862 does
[15:08] <Katana`> you should have something like http://localhost/ezpublish,
and http://localhost/ezpRestDemo.php
[15:09] <Katana`> do you see what I mean ?
[15:10] <tcv_br> mmm... ok
[15:10] <Katana`> http://localhost/ezpRestDemo.php could be anything:
another website, an iPhone or Android app... etc
[15:11] <Katana`> so, with the example above, what you would enter in
Endpoint URI is http://localhost/ezpRestDemo.php
[15:11] * i-robin is reading along, interesting :)
[15:11] <Katana`> and in ezpRestDemo.php, you just set $eZHost = '
http://localhost/ezpublish', and $appClientId = 'The MD5 string on
oauthadmin/view/1'
[15:11] <Katana`> that's all :)
[15:12] <Katana`> then you can try http://localhost/ezpRestDemo.php, which
should trigger the oAuth2 process, then give you info from node #2 (by
default)
[15:15] <Katana`> then, icing on the cake, in extension/rest/ezp_api, you'll
find the next gen eZ Publish PHP API
[15:16] <Katana`> It should be fully documented with phpdoc, you can
generate it. You also have examples in extension/rest/ezp_api/examples/
[15:16] <tcv_br> Parse error: syntax error, unexpected T_FUNCTION in
/var/www/ezprojects/teste2/ezpRestDemo.php on line 60
[15:16] <Katana`> do you have PHP 5.3 ?
[15:16] <tcv_br> wait
[15:16] * Katana` whistles :p
[15:16] <Katana`> the script uses an anonymous function, sorry, I really
wanted to use shiny stuff today ;)
[15:17] <tcv_br> 5.2.6-1
[15:17] <Katana`> yep, you need to edit the script a bit
[15:17] <Katana`> line 60
[15:18] <Katana`> just declare the anonymous function as a real function,
and use the function's name as the 2nd parameter for array_walk
[15:18] <tcv_br> ok
[15:20] <Katana`> php < 5.3.0 version : http://gist.github.com/603241
[15:20] *** carlos_ ([email protected]) joined
[15:20] <Katana`> not tested :p
[15:20] <Katana`> hey Carlos
[15:20] <carlos_> hey
[15:21] <carlos_> i've just read your tweet
[15:21] <Katana`> :)
[15:21] <carlos_> free lesson here? :D
[15:21] <Katana`> well, I have written a LOT already :D
[15:21] <carlos_> maybe if someone has it logged could send my by e-mail or
something...
[15:21] <Katana`> I've fixed the fact that the REST demo script requires PHP
5.3
[15:21] <Katana`> I can
[15:21] <carlos_> great
[15:22] <Katana`> sent
[15:23] <carlos_> thanks
[15:24] <tcv_br> oh man
[15:24] <Katana`> yeah ?
[15:25] <tcv_br> An error occured. These are the response headers from the
REST service:
[15:25] <Katana`> ah, at least that's something :)
[15:25] <tcv_br> [0] => HTTP/1.0 404 Not Found
[15:25] <Katana`> 404 ?
[15:25] <Katana`> hmmm... did you change the URIs in the script ? ;)
[15:25] <tcv_br> yes
[15:25] <tcv_br>
http://laplace/ezprojects/teste2/ezpRestDemo.php?access_token=b24155080ae692401422e8f2c845e133b5840273&expires_in=3600&resource=content/node/2
[15:25] <Katana`> hmmm...
[15:25] <Katana`> why would that return a 404...
[15:26] <Katana`> (you can remove the access_token.php & expires_in
parameters, they're stored in the session)
[15:26] <tcv_br> [4] => Set-Cookie: ZDEDebuggerPresent=php,phtml,php3;
path=/
[15:26] <tcv_br> [7] => Cache-Control: no-cache, must-revalidate
[15:26] <Katana`> have you linked/copied index_rest.php & created the
rewrite rule ?
[15:27] <Katana`> aaah, do you have mod_rewrite enabled ?
[15:27] <Katana`> it won't work without the rules, but we can make it work
[15:27] <tcv_br> I don't use mod_rewrite, I don't use htaccess
[15:27] <Katana`> ok
[15:27] <tcv_br> but i linkes
[15:27] <tcv_br> linked
[15:27] <Katana`> what do you get if you go to
http://localhost/ezpublish/extension/rest/index_rest.php ?
[15:28] <Katana`> oh, ok
[15:28] <Katana`> perfect
[15:28] <Katana`> the instead of just http://localhost/ezpublish/, use
http://localhost/ezpublish/index_rest.php
[15:28] <tcv_br> wait, I think it didn't klinked
[15:28] <Katana`> it should work
[15:28] <Katana`> hmm... I hope it will... damn
[15:28] *** carlos_ quit (Ping timeout: 245 seconds)
[15:29] <i-robin> and carlos left the building :)
[15:30] <Katana`> :)
[15:30] <i-robin> i hope to check out the script soon, what features does it
have?
[15:30] <i-robin> what exactly can you control in eZ?
[15:30] <Katana`> not much... you can pretty much is it to query the
existing REST services (content/object and content/node), and see the output
[15:30] <Katana`> starting from there, the road's open :)
[15:31] <Katana`> you get a JSON object, do what you have to with it
[15:31] <tcv_br> hey
[15:31] <tcv_br> A strange think is happening here
[15:31] <Katana`> like ?
[15:32] <tcv_br> When I try to access index_rest.php direct in my browser, I
got 404
[15:32] <tcv_br> but if I edit it and remove all content, it access
[15:32] <Katana`> try index_rest.php/content/node/2
[15:32] <Katana`> it is supposed to return a 404 if you use it like this;
404 here means resource not found, as we don't tell him what it should do :)
[15:33] <tcv_br> same problem
[15:33] <Katana`> still a 404 ?
[15:33] <Katana`> hum
[15:33] <tcv_br> yeah
[15:33] <Katana`> there might be something wrong with the lack of rewrite
rule :(
[15:34] <Katana`> I think the MVC controller doesn't filter it out, and it
breaks routing
[15:35] <Katana`> can you edit a file and add a line ?
[15:35] <Katana`> I *might* have a solution
[15:35] <tcv_br> ok
[15:36] <Katana`> edit extension/rest/classes/mvc_configuration.php
[15:37] <Katana`> on the createRequestParser() method, line 20, add
$parser->prefix = preg_replace( '@/index_rest\.php$@', '', basename(
$_SERVER['SCRIPT_FILENAME'] ) ); between the two lines
[15:37] <tcv_br> ok
[15:37] <Katana`> and try again... it could work :)
[15:39] <tcv_br> nope, but is someone else testing it, or is just me that is
geting these poblem
[15:39] <Katana`> doesn't help ?
[15:39] <Katana`> shit...
[15:39] *** paul-ez ([email protected]) joined
[15:39] <tcv_br> wait for more people testing it
[15:40] <Katana`> as you wish, but I know why you're getting this
[15:40] <tcv_br> I think it could be something with my server...
[15:40] <Katana`> I'm starting my laptop, I'll give it a try without
mod_rewrite, it won't take long
[15:40] <i-robin> not testing myself here yet
[15:41] *** carlos_ ([email protected])
joined
[15:42] <Katana`> ok, I get the same error as you do with mod_rewrite
disabled

--
Thiago Campos Viana

Bacharelado em Informática - ICMC - USP
-- 
Sdk-public mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/sdk-public

Reply via email to