This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Developer » Old Rest API v1 - acces to read php...
expandshrink

Old Rest API v1 - acces to read php stream

Old Rest API v1 - acces to read php stream

Thursday 10 January 2013 3:26:38 pm - 3 replies

Hi.

I am having issues with converting an old module to rest style solution.

I need to read contents from the php://input stream.

This does not work when setting up my rest controller to listen to incoming data.

When debugging the data is present and available in my index_rest.php file, but seems to be lost while using the eZComponents.

Please anyone .. share you knowledgehappy.gif Emoticon

update 1: I have now dug through the rest framework and can see that the stream is read by the surrounding code.. need to figure out how to access these data in my function.

Modified on Thursday 10 January 2013 3:46:46 pm by Lars Eirik Roenning

Thursday 10 January 2013 4:56:24 pm

Take a look on kernel/private/rest/classes/request/http_parser.php ezpRestHttpRequestParser::processBody() php://input content is assigned into request->body. That method is executed in parent class ezcMvcHttpRequestParser::processStandardHeaders() which is part of the ezcMvcTools. Hope this helps.

Thursday 10 January 2013 8:58:25 pm

Which version of eZ are you on?

That part of the code was changed a bit in between versions, e.g. to accommodate the needs of ezcontentstaging.

You can look at the "patched" classes in the ezcontenstaging github for more details...

Thursday 17 January 2013 10:27:58 am

Sorry, i did not update this.

I managed to figure out how to access the stream.

I am currently on ez4.5

I have one issue though. Today my execution to import data is done sucessfully with ez4.x modules.

When i do the same using the rest api the exact same code shows different behaviour. Typically it seems to be related to reading from the db to fetch existing objects.

I have added eZModule::setGlobalPathList("kernel"blunk.gif Emoticon to be able to run eZExcutionHandler for instance.

Is there any thing i need to be aware of when using the rest API?

I can see that the datastream is available, but when entering my custom code the processing stops.

I have disabled caching for development in site.ini as well as in rest.ini.

Looking at jira.ez.no i am able to spot a few bugs pertaining to content cache. It appears to me that cleaning the eZ cache makes the rest service unstable. 

If cache is not cleaned using the admin or the cli script it appears to work ok.

Any thing i need to be aware of?

Perhaps looking at the ezcontentstaging is a smart move..

Modified on Thursday 17 January 2013 7:42:53 pm by Lars Eirik Roenning

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from